1 ;;; cus-start.el --- define customization properties of builtins -*- lexical-binding:t -*-
3 ;; Copyright (C) 1997, 1999-2016 Free Software Foundation, Inc.
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; This file adds customize support for built-in variables.
28 ;; While dumping Emacs, this file is loaded, but it only records
29 ;; the standard values; it does not do the rest of the job.
30 ;; Later on, if the user makes a customization buffer,
31 ;; this file is loaded again with (require 'cus-start);
32 ;; then it does the whole job.
36 (defun minibuffer-prompt-properties--setter (symbol value
)
37 (set-default symbol value
)
38 (if (memq 'cursor-intangible value
)
39 (add-hook 'minibuffer-setup-hook
'cursor-intangible-mode
)
40 ;; Removing it is a bit trickier since it could have been added by someone
41 ;; else as well, so let's just not bother.
44 ;; Elements of this list have the form:
45 ;; SYMBOL GROUP TYPE VERSION REST...
46 ;; SYMBOL is the name of the variable.
47 ;; GROUP is the custom group to which it belongs (may also be a list
49 ;; TYPE is the defcustom :type.
50 ;; VERSION is the defcustom :version (or nil).
51 ;; REST is a set of :KEYWORD VALUE pairs. Accepted :KEYWORDs are:
52 ;; :standard - standard value for SYMBOL (else use current value)
53 ;; :set - custom-set property
54 ;; :risky - risky-local-variable property
55 ;; :safe - safe-local-variable property
56 ;; :tag - custom-tag property
59 ;; This function turns a value
60 ;; into an expression which produces that value.
61 (quoter (lambda (sexp)
62 ;; FIXME: We'd like to use macroexp-quote here, but cus-start
63 ;; is loaded too early in loadup.el for that.
64 (if (or (memq sexp
'(t nil
))
67 (memq (car sexp
) '(lambda)))
74 (const :tag
"Frame default" t
)
75 (const :tag
"Filled box" box
)
76 (const :tag
"Hollow cursor" hollow
)
77 (const :tag
"Vertical bar" bar
)
78 (cons :tag
"Vertical bar with specified width"
80 (const :tag
"Horizontal bar" hbar
)
81 (cons :tag
"Horizontal bar with specified width"
83 (const :tag
"None "nil
))))
85 (`(,symbol
,group
,type
,version .
,rest
)
87 (gc-cons-threshold alloc integer
)
88 (gc-cons-percentage alloc float
)
89 (garbage-collection-messages alloc boolean
)
91 (cursor-type display
,cursor-type-types
)
92 (mode-line-format mode-line sexp
) ;Hard to do right.
93 (major-mode internal function
)
94 (case-fold-search matching boolean
)
95 (fill-column fill integer
)
96 (left-margin fill integer
)
97 (tab-width editing-basics integer
)
98 (ctl-arrow display boolean
)
99 (truncate-lines display boolean
)
100 (word-wrap display boolean
)
101 (selective-display-ellipses display boolean
)
102 (indicate-empty-lines fringe boolean
)
103 (indicate-buffer-boundaries
106 (const :tag
"No indicators" nil
)
107 (const :tag
"On left, with arrows" left
)
108 (const :tag
"On right, with arrows" right
)
109 (set :tag
"Pick your own design"
111 :format
"%{%t%}:\n%v\n%d"
112 :doc
"You can specify a default and then override it \
113 for individual indicators.
114 Leaving \"Default\" unchecked is equivalent with specifying a default of
116 (choice :tag
"Default"
118 (const :tag
"Do not show" (t . nil
))
119 (const :tag
"On the left" (t . left
))
120 (const :tag
"On the right" (t . right
)))
123 (const :tag
"Do not show" (top . nil
))
124 (const :tag
"On the left" (top . left
))
125 (const :tag
"On the right" (top . right
)))
126 (choice :tag
"Bottom"
127 :value
(bottom . left
)
128 (const :tag
"Do not show" (bottom . nil
))
129 (const :tag
"On the left" (bottom . left
))
130 (const :tag
"On the right" (bottom . right
)))
131 (choice :tag
"Up arrow"
133 (const :tag
"Do not show" (up . nil
))
134 (const :tag
"On the left" (up . left
))
135 (const :tag
"On the right" (up . right
)))
136 (choice :tag
"Down arrow"
138 (const :tag
"Do not show" (down . nil
))
139 (const :tag
"On the left" (down . left
))
140 (const :tag
"On the right" (down . right
))))
141 (other :tag
"On left, no arrows" t
)))
142 (scroll-up-aggressively windows
143 (choice (const :tag
"off" nil
) float
)
145 (scroll-down-aggressively windows
146 (choice (const :tag
"off" nil
) float
)
148 (line-spacing display
(choice (const :tag
"none" nil
) number
)
150 (cursor-in-non-selected-windows
151 cursor
,cursor-type-types nil
152 :tag
"Cursor In Non-selected Windows"
153 :set
(lambda (symbol value
)
154 (set-default symbol value
)
155 (force-mode-line-update t
)))
156 (transient-mark-mode editing-basics boolean nil
157 :standard
(not noninteractive
)
158 :initialize custom-initialize-delay
159 :set custom-set-minor-mode
)
160 (bidi-paragraph-direction
163 (const :tag
"Left to Right" left-to-right
)
164 (const :tag
"Right to Left" right-to-left
)
165 (const :tag
"Dynamic, according to paragraph text" nil
))
168 (mark-even-if-inactive editing-basics boolean
)
170 (shell-file-name execute file
)
172 (repeat (choice (const :tag
"default directory" nil
)
173 (directory :format
"%v")))
177 (if f
(directory-file-name f
)
179 (append (parse-colon-path (getenv "PATH"))
180 (list exec-directory
))))
181 (exec-suffixes execute
(repeat string
))
183 (charset-map-path installation
184 (repeat (directory :format
"%v")))
186 (inhibit-eol-conversion mule boolean
)
187 (enable-character-translation mule boolean
)
188 (eol-mnemonic-undecided mule string
)
189 ;; startup.el fiddles with the values. IMO, would be
190 ;; simpler to just use #ifdefs in coding.c.
191 (eol-mnemonic-unix mule string nil
193 (if (memq system-type
'(ms-dos windows-nt
))
195 (eol-mnemonic-dos mule string nil
197 (if (memq system-type
'(ms-dos windows-nt
))
199 (eol-mnemonic-mac mule string nil
201 (file-coding-system-alist
204 :key-type
(regexp :tag
"File regexp")
206 :value
(undecided . undecided
)
207 (cons :tag
"Encoding/decoding pair"
208 :value
(undecided . undecided
)
209 (coding-system :tag
"Decoding")
210 (coding-system :tag
"Encoding"))
212 :tag
"Single coding system"
214 :match
(lambda (widget value
)
215 (and value
(not (functionp value
)))))
216 (function :value ignore
))))
218 (completion-ignored-extensions dired
219 (repeat (string :format
"%v")))
221 (baud-rate display integer
)
222 (inverse-video display boolean
)
223 (visible-bell display boolean
)
224 (no-redraw-on-reenter display boolean
)
227 (dos-display-scancodes display boolean
)
228 (dos-hyper-key keyboard integer
)
229 (dos-super-key keyboard integer
)
230 (dos-keypad-mode keyboard integer
)
233 (user-full-name mail string
)
235 (report-emacs-bug-address emacsbug string
)
237 (max-specpdl-size limits integer
)
238 (max-lisp-eval-depth limits integer
)
239 (max-mini-window-height limits
240 (choice (const :tag
"quarter screen" nil
)
242 (debug-on-error debug
243 (choice (const :tag
"off")
244 (repeat :menu-tag
"When"
246 (symbol :format
"%v"))
247 (const :tag
"always" t
)))
248 (debug-ignored-errors debug
(repeat (choice symbol regexp
)))
249 (debug-on-quit debug boolean
)
250 (debug-on-signal debug boolean
)
252 (delete-by-moving-to-trash auto-save boolean
"23.1")
253 (auto-save-visited-file-name auto-save boolean
)
255 (create-lockfiles files boolean
"24.3")
256 (temporary-file-directory
257 ;; Darwin section added 24.1, does not seem worth :version bump.
260 (file-name-as-directory
261 ;; FIXME ? Should there be Ftemporary_file_directory to do this
262 ;; more robustly (cf set_local_socket in emacsclient.c).
263 ;; It could be used elsewhere, eg Fcall_process_region,
264 ;; server-socket-dir. See bug#7135.
265 (cond ((memq system-type
'(ms-dos windows-nt
))
266 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
268 ((eq system-type
'darwin
)
269 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
271 (let ((tmp (ignore-errors
272 (shell-command-to-string
273 "getconf DARWIN_USER_TEMP_DIR"))))
275 (setq tmp
(replace-regexp-in-string
277 ;; Handles "getconf: Unrecognized variable..."
278 (file-directory-p tmp
)
282 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
284 :initialize custom-initialize-delay
)
286 (use-dialog-box menu boolean
"21.1")
287 (use-file-dialog menu boolean
"22.1")
288 (focus-follows-mouse frames boolean
"20.3")
290 ;; FIXME nil is the initial value, fontset.el setqs it.
291 (vertical-centering-font-regexp display
292 (choice (const nil
) regexp
))
294 (default-frame-alist frames
295 (repeat (cons :format
"%v"
296 (symbol :tag
"Parameter")
297 (sexp :tag
"Value"))))
298 (mouse-highlight mouse
(choice (const :tag
"disabled" nil
)
299 (const :tag
"always shown" t
)
300 (other :tag
"hidden by keypress" 1))
302 (make-pointer-invisible mouse boolean
"23.2")
303 (menu-bar-mode frames boolean nil
305 ;; :initialize custom-initialize-default
306 :set custom-set-minor-mode
)
307 (tool-bar-mode (frames mouse
) boolean nil
308 ;; :initialize custom-initialize-default
309 :set custom-set-minor-mode
)
310 (frame-resize-pixelwise frames boolean
"24.4")
311 (frame-inhibit-implied-resize frames
313 (const :tag
"Never" nil
)
314 (const :tag
"Always" t
)
315 (repeat (symbol :tag
"Parameter")))
318 (overflow-newline-into-fringe fringe boolean
)
320 (imagemagick-render-type image integer
"24.1")
322 (indent-tabs-mode indent boolean
)
324 (meta-prefix-char keyboard character
)
325 (auto-save-interval auto-save integer
)
326 (auto-save-timeout auto-save
(choice (const :tag
"off" nil
)
327 (integer :format
"%v")))
328 (echo-keystrokes minibuffer number
)
329 (polling-period keyboard integer
)
330 (double-click-time mouse
(restricted-sexp
331 :match-alternatives
(integerp 'nil
't
)))
332 (double-click-fuzz mouse integer
"22.1")
333 (help-char keyboard character
)
334 (help-event-list keyboard
(repeat (sexp :format
"%v")))
335 (menu-prompting menu boolean
)
336 (select-active-regions killing
337 (choice (const :tag
"always" t
)
338 (const :tag
"only shift-selection or mouse-drag" only
)
339 (const :tag
"off" nil
))
341 (debug-on-event debug
342 (choice (const :tag
"None" nil
)
343 (const :tag
"When sent SIGUSR1" sigusr1
)
344 (const :tag
"When sent SIGUSR2" sigusr2
))
347 ;; This is not good news because it will use the wrong
348 ;; version-specific directories when you upgrade. We need
349 ;; customization of the front of the list, maintaining the
350 ;; standard value intact at the back.
351 ;;(load-path environment
352 ;; (repeat (choice :tag "[Current dir?]"
353 ;; :format "%[Current dir?%] %v"
354 ;; (const :tag " current dir" nil)
355 ;; (directory :format "%v"))))
356 (load-prefer-newer lisp boolean
"24.4")
358 (enable-recursive-minibuffers minibuffer boolean
)
359 (history-length minibuffer
360 (choice (const :tag
"Infinite" t
) integer
)
362 (history-delete-duplicates minibuffer boolean
"22.1")
363 (read-buffer-completion-ignore-case minibuffer boolean
"23.1")
365 (minibuffer-prompt-properties
369 (const :tag
"Read-Only"
370 :doc
"Prevent prompt from being modified"
374 (const :tag
"Don't Enter"
375 :doc
"Prevent point from ever entering prompt"
378 (cursor-intangible t
)))
380 :tag
"Other Properties"
383 (symbol :tag
"Property")
384 (sexp :tag
"Value"))))
386 :set minibuffer-prompt-properties--setter
)
387 (minibuffer-auto-raise minibuffer boolean
)
388 ;; options property set at end
389 (read-buffer-function minibuffer
393 (dos-unsupported-char-glyph display integer
)
397 (choice (const :tag
"No modifier" nil
)
398 (const control
) (const meta
)
399 (const alt
) (const hyper
)
400 (const super
)) "23.1")
401 (ns-right-control-modifier
403 (choice (const :tag
"No modifier (work as control)" none
)
404 (const :tag
"Use the value of ns-control-modifier"
406 (const control
) (const meta
)
407 (const alt
) (const hyper
)
408 (const super
)) "24.1")
411 (choice (const :tag
"No modifier" nil
)
412 (const control
) (const meta
)
413 (const alt
) (const hyper
)
414 (const super
)) "23.1")
415 (ns-right-command-modifier
417 (choice (const :tag
"No modifier (work as command)" none
)
418 (const :tag
"Use the value of ns-command-modifier"
420 (const control
) (const meta
)
421 (const alt
) (const hyper
)
422 (const super
)) "24.1")
423 (ns-alternate-modifier
425 (choice (const :tag
"No modifier (work as alternate/option)" none
)
426 (const control
) (const meta
)
427 (const alt
) (const hyper
)
428 (const super
)) "23.1")
429 (ns-right-alternate-modifier
431 (choice (const :tag
"No modifier (work as alternate/option)" none
)
432 (const :tag
"Use the value of ns-alternate-modifier"
434 (const control
) (const meta
)
435 (const alt
) (const hyper
)
436 (const super
)) "23.3")
437 (ns-function-modifier
439 (choice (const :tag
"No modifier (work as function)" none
)
440 (const control
) (const meta
)
441 (const alt
) (const hyper
)
442 (const super
)) "23.1")
443 (ns-antialias-text ns boolean
"23.1")
444 (ns-auto-hide-menu-bar ns boolean
"24.1")
445 (ns-confirm-quit ns boolean
"25.1")
446 (ns-use-native-fullscreen ns boolean
"24.4")
447 (ns-use-fullscreen-animation ns boolean
"25.1")
448 (ns-use-srgb-colorspace ns boolean
"24.4")
450 (delete-exited-processes processes-basics boolean
)
452 (parse-sexp-ignore-comments editing-basics boolean
)
453 (words-include-escapes editing-basics boolean
)
454 (open-paren-in-column-0-is-defun-start editing-basics boolean
457 (visible-cursor cursor boolean
"22.1")
459 (ring-bell-function display
461 (const :tag
"Default" nil
)
462 (const :tag
"Silent" ignore
)
465 (undo-limit undo integer
)
466 (undo-strong-limit undo integer
)
467 (undo-outer-limit undo
469 (const :tag
"No limit"
473 the undo info for the current command never gets discarded.
474 This should only be chosen under exceptional circumstances,
475 since it could result in memory overflow and make Emacs crash."
479 (temp-buffer-show-function windows
(choice (const nil
) function
))
480 (next-screen-context-lines windows integer
)
481 (scroll-preserve-screen-position
483 (const :tag
"Off (nil)" :value nil
)
484 (const :tag
"Full screen (t)" :value t
)
485 (other :tag
"Always" 1)) "22.1")
488 (const :tag
"Never (nil)" :value nil
)
489 (const :tag
"Only on ttys" :value tty
)
490 (other :tag
"Always" t
)) "23.1")
491 (window-combination-resize windows boolean
"24.1")
492 (window-combination-limit
494 (const :tag
"Never (nil)" :value nil
)
495 (const :tag
"For Temp Buffer Resize mode (temp-buffer-resize)"
496 :value temp-buffer-resize
)
497 (const :tag
"For temporary buffers (temp-buffer)"
499 (const :tag
"For buffer display (display-buffer)"
500 :value display-buffer
)
501 (other :tag
"Always (t)" :value t
))
503 (fast-but-imprecise-scrolling scrolling boolean
"25.1")
504 (window-resize-pixelwise windows boolean
"24.4")
506 ;; The whitespace group is for whitespace.el.
507 (show-trailing-whitespace editing-basics boolean nil
509 (scroll-step windows integer
)
510 (scroll-conservatively windows integer
)
511 (scroll-margin windows integer
)
512 (hscroll-margin windows integer
"22.1")
513 (hscroll-step windows number
"22.1")
514 (truncate-partial-width-windows
516 (choice (integer :tag
"Truncate if narrower than")
517 (const :tag
"Respect `truncate-lines'" nil
)
518 (other :tag
"Truncate if not full-width" t
))
520 (make-cursor-line-fully-visible windows boolean
)
521 (mode-line-in-non-selected-windows mode-line boolean
"22.1")
522 (line-number-display-limit display
524 (const :tag
"No limit" nil
)))
525 (line-number-display-limit-width display integer
"22.1")
526 (highlight-nonselected-windows display boolean
)
527 (message-log-max debug
(choice (const :tag
"Disable" nil
)
528 (integer :menu-tag
"lines"
530 (other :tag
"Unlimited" t
))
532 (unibyte-display-via-language-environment mule boolean
)
533 (blink-cursor-alist cursor alist
"22.1")
534 (overline-margin display integer
"22.1")
535 (underline-minimum-offset display integer
"23.1")
536 (mouse-autoselect-window
538 (const :tag
"Off (nil)" :value nil
)
539 (const :tag
"Immediate" :value t
)
540 (number :tag
"Delay by secs" :value
0.5)) "22.1")
543 (const :tag
"Images" :value image
)
544 (const :tag
"Text" :value text
)
545 (const :tag
"Both" :value both
)
546 (const :tag
"Both-horiz" :value both-horiz
)
547 (const :tag
"Text-image-horiz" :value text-image-horiz
)
548 (const :tag
"System default" :value nil
)) "24.1")
549 (tool-bar-max-label-size frames integer
"24.1")
550 (auto-hscroll-mode scrolling boolean
"21.1")
551 (void-text-area-pointer cursor
553 (const :tag
"Standard (text pointer)" :value nil
)
554 (const :tag
"Arrow" :value arrow
)
555 (const :tag
"Text pointer" :value text
)
556 (const :tag
"Hand" :value hand
)
557 (const :tag
"Vertical dragger" :value vdrag
)
558 (const :tag
"Horizontal dragger" :value hdrag
)
559 (const :tag
"Same as mode line" :value modeline
)
560 (const :tag
"Hourglass" :value hourglass
)))
561 (display-hourglass cursor boolean
)
562 (hourglass-delay cursor number
)
565 (const :tag
"Off (nil)" :value nil
)
566 (const :tag
"Fit (t)" :value t
)
567 (const :tag
"Grow only" :value grow-only
))
570 (scalable-fonts-allowed display boolean
"22.1")
572 (x-bitmap-file-path installation
573 (repeat (directory :format
"%v")))
574 (x-gtk-use-old-file-dialog menu boolean
"22.1")
575 (x-gtk-show-hidden-files menu boolean
"22.1")
576 (x-gtk-file-dialog-help-text menu boolean
"22.1")
577 (x-gtk-use-system-tooltips tooltip boolean
"23.3")
579 (x-use-underline-position-properties display boolean
"22.1")
580 (x-underline-at-descent-line display boolean
"22.1")
581 (x-stretch-cursor display boolean
"21.1")
582 (scroll-bar-adjust-thumb-portion windows boolean
"24.4")
584 (x-select-enable-clipboard-manager killing boolean
"24.1")
586 (font-use-system-font font-selection boolean
"23.2")))
587 (setq ;; If we did not specify any standard value expression above,
588 ;; use the current value as the standard value.
589 standard
(if (setq prop
(memq :standard rest
))
591 (if (default-boundp symbol
)
592 (funcall quoter
(default-value symbol
))))
593 ;; Don't complain about missing variables which are
594 ;; irrelevant to this platform.
595 native-p
(save-match-data
597 ((string-match "\\`dos-" (symbol-name symbol
))
598 (eq system-type
'ms-dos
))
599 ((string-match "\\`w32-" (symbol-name symbol
))
600 (eq system-type
'windows-nt
))
601 ((string-match "\\`ns-" (symbol-name symbol
))
603 ((string-match "\\`x-.*gtk" (symbol-name symbol
))
605 ((string-match "clipboard-manager" (symbol-name symbol
))
606 (boundp 'x-select-enable-clipboard-manager
))
607 ((string-match "\\`x-" (symbol-name symbol
))
608 (fboundp 'x-create-frame
))
609 ((string-match "selection" (symbol-name symbol
))
610 (fboundp 'x-selection-exists-p
))
611 ((string-match "fringe" (symbol-name symbol
))
612 (fboundp 'define-fringe-bitmap
))
613 ((string-match "\\`imagemagick" (symbol-name symbol
))
614 (fboundp 'imagemagick-types
))
615 ((equal "font-use-system-font" (symbol-name symbol
))
616 (featurep 'system-font-setting
))
617 ;; Conditioned on x-create-frame, because that's
618 ;; the condition for loadup.el to preload tool-bar.el.
619 ((string-match "tool-bar-" (symbol-name symbol
))
620 (fboundp 'x-create-frame
))
621 ((equal "vertical-centering-font-regexp"
622 (symbol-name symbol
))
623 ;; Any function from fontset.c will do.
624 (fboundp 'new-fontset
))
625 ((equal "scroll-bar-adjust-thumb-portion"
626 (symbol-name symbol
))
629 (if (not (boundp symbol
))
630 ;; If variables are removed from C code, give an error here!
632 (message "Note, built-in variable `%S' not bound" symbol
))
633 ;; Save the standard value, unless we already did.
634 (or (get symbol
'standard-value
)
635 (put symbol
'standard-value
(list standard
)))
636 ;; We need these properties independent of whether cus-start is loaded.
637 (if (setq prop
(memq :safe rest
))
638 (put symbol
'safe-local-variable
(cadr prop
)))
639 (if (setq prop
(memq :risky rest
))
640 (put symbol
'risky-local-variable
(cadr prop
)))
641 (if (setq prop
(memq :set rest
))
642 (put symbol
'custom-set
(cadr prop
)))
643 ;; Note this is the _only_ initialize property we handle.
644 (if (eq (cadr (memq :initialize rest
)) 'custom-initialize-delay
)
645 ;; These vars are defined early and should hence be initialized
646 ;; early, even if this file happens to be loaded late. so add them
647 ;; to the end of custom-delayed-init-variables. Otherwise,
648 ;; auto-save-file-name-transforms will appear in M-x customize-rogue.
649 (add-to-list 'custom-delayed-init-variables symbol
'append
))
650 ;; If this is NOT while dumping Emacs, set up the rest of the
651 ;; customization info. This is the stuff that is not needed
652 ;; until someone does M-x customize etc.
654 ;; Add it to the right group(s).
657 (custom-add-to-group g symbol
'custom-variable
))
658 (custom-add-to-group group symbol
'custom-variable
))
660 (put symbol
'custom-type type
)
661 (if version
(put symbol
'custom-version version
))
663 (setq prop
(car rest
)
665 rest
(nthcdr 2 rest
))
666 (cond ((memq prop
'(:standard
:risky
:safe
:set
))) ; handled above
668 (put symbol
'custom-tag propval
))))))))
670 (custom-add-to-group 'font-lock
'open-paren-in-column-0-is-defun-start
673 ;; Record cus-start as loaded if we have set up all the info that we can.
674 ;; Don't record it as loaded if we have only set up the standard values
675 ;; and safe/risky properties.
677 (provide 'cus-start
))
679 ;;; cus-start.el ends here