1 ;;; cus-start.el --- define customization properties of builtins -*- lexical-binding:t -*-
3 ;; Copyright (C) 1997, 1999-2015 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
57 (let (standard native-p prop propval
58 ;; This function turns a value
59 ;; into an expression which produces that value.
60 (quoter (lambda (sexp)
61 ;; FIXME: We'd like to use macroexp-quote here, but cus-start
62 ;; is loaded too early in loadup.el for that.
63 (if (or (memq sexp
'(t nil
))
66 (memq (car sexp
) '(lambda)))
70 (list 'quote sexp
)))))
72 (`(,symbol
,group
,type
,version .
,rest
)
74 (gc-cons-threshold alloc integer
)
75 (gc-cons-percentage alloc float
)
76 (garbage-collection-messages alloc boolean
)
81 (const :tag
"Frame default" t
)
82 (const :tag
"Filled box" box
)
83 (const :tag
"Hollow cursor" hollow
)
84 (const :tag
"Vertical bar" bar
)
85 (cons :tag
"Vertical bar with specified width"
87 (const :tag
"Horizontal bar" hbar
)
88 (cons :tag
"Horizontal bar with specified width"
90 (const :tag
"None "nil
)))
91 (mode-line-format mode-line sexp
) ;Hard to do right.
92 (major-mode internal function
)
93 (case-fold-search matching boolean
)
94 (fill-column fill integer
)
95 (left-margin fill integer
)
96 (tab-width editing-basics integer
)
97 (ctl-arrow display boolean
)
98 (truncate-lines display boolean
)
99 (word-wrap display boolean
)
100 (selective-display-ellipses display boolean
)
101 (indicate-empty-lines fringe boolean
)
102 (indicate-buffer-boundaries
105 (const :tag
"No indicators" nil
)
106 (const :tag
"On left, with arrows" left
)
107 (const :tag
"On right, with arrows" right
)
108 (set :tag
"Pick your own design"
110 :format
"%{%t%}:\n%v\n%d"
111 :doc
"You can specify a default and then override it \
112 for individual indicators.
113 Leaving \"Default\" unchecked is equivalent with specifying a default of
115 (choice :tag
"Default"
117 (const :tag
"Do not show" (t . nil
))
118 (const :tag
"On the left" (t . left
))
119 (const :tag
"On the right" (t . right
)))
122 (const :tag
"Do not show" (top . nil
))
123 (const :tag
"On the left" (top . left
))
124 (const :tag
"On the right" (top . right
)))
125 (choice :tag
"Bottom"
126 :value
(bottom . left
)
127 (const :tag
"Do not show" (bottom . nil
))
128 (const :tag
"On the left" (bottom . left
))
129 (const :tag
"On the right" (bottom . right
)))
130 (choice :tag
"Up arrow"
132 (const :tag
"Do not show" (up . nil
))
133 (const :tag
"On the left" (up . left
))
134 (const :tag
"On the right" (up . right
)))
135 (choice :tag
"Down arrow"
137 (const :tag
"Do not show" (down . nil
))
138 (const :tag
"On the left" (down . left
))
139 (const :tag
"On the right" (down . right
))))
140 (other :tag
"On left, no arrows" t
)))
141 (scroll-up-aggressively windows
142 (choice (const :tag
"off" nil
) float
)
144 (scroll-down-aggressively windows
145 (choice (const :tag
"off" nil
) float
)
147 (line-spacing display
(choice (const :tag
"none" nil
) number
)
149 (cursor-in-non-selected-windows
151 :tag
"Cursor In Non-selected Windows"
152 :set
(lambda (symbol value
)
153 (set-default symbol value
)
154 (force-mode-line-update t
)))
155 (transient-mark-mode editing-basics boolean nil
156 :standard
(not noninteractive
)
157 :initialize custom-initialize-delay
158 :set custom-set-minor-mode
)
159 (bidi-paragraph-direction
162 (const :tag
"Left to Right" left-to-right
)
163 (const :tag
"Right to Left" right-to-left
)
164 (const :tag
"Dynamic, according to paragraph text" nil
))
167 (mark-even-if-inactive editing-basics boolean
)
169 (shell-file-name execute file
)
171 (repeat (choice (const :tag
"default directory" nil
)
172 (directory :format
"%v")))
175 (mapcar 'directory-file-name
176 (append (parse-colon-path (getenv "PATH"))
177 (list exec-directory
))))
178 (exec-suffixes execute
(repeat string
))
180 (charset-map-path installation
181 (repeat (directory :format
"%v")))
183 (inhibit-eol-conversion mule boolean
)
184 (eol-mnemonic-undecided mule string
)
185 ;; startup.el fiddles with the values. IMO, would be
186 ;; simpler to just use #ifdefs in coding.c.
187 (eol-mnemonic-unix mule string nil
189 (if (memq system-type
'(ms-dos windows-nt
))
191 (eol-mnemonic-dos mule string nil
193 (if (memq system-type
'(ms-dos windows-nt
))
195 (eol-mnemonic-mac mule string nil
197 (file-coding-system-alist
200 :key-type
(regexp :tag
"File regexp")
202 :value
(undecided . undecided
)
203 (cons :tag
"Encoding/decoding pair"
204 :value
(undecided . undecided
)
205 (coding-system :tag
"Decoding")
206 (coding-system :tag
"Encoding"))
208 :tag
"Single coding system"
210 :match
(lambda (widget value
)
211 (and value
(not (functionp value
)))))
212 (function :value ignore
))))
214 (completion-ignored-extensions dired
215 (repeat (string :format
"%v")))
217 (baud-rate display integer
)
218 (inverse-video display boolean
)
219 (visible-bell display boolean
)
220 (no-redraw-on-reenter display boolean
)
223 (dos-display-scancodes display boolean
)
224 (dos-hyper-key keyboard integer
)
225 (dos-super-key keyboard integer
)
226 (dos-keypad-mode keyboard integer
)
229 (user-full-name mail string
)
231 (report-emacs-bug-address emacsbug string
)
233 (max-specpdl-size limits integer
)
234 (max-lisp-eval-depth limits integer
)
235 (max-mini-window-height limits
236 (choice (const :tag
"quarter screen" nil
)
238 (debug-on-error debug
239 (choice (const :tag
"off")
240 (repeat :menu-tag
"When"
242 (symbol :format
"%v"))
243 (const :tag
"always" t
)))
244 (debug-ignored-errors debug
(repeat (choice symbol regexp
)))
245 (debug-on-quit debug boolean
)
246 (debug-on-signal debug boolean
)
248 (delete-by-moving-to-trash auto-save boolean
"23.1")
249 (auto-save-visited-file-name auto-save boolean
)
251 (create-lockfiles files boolean
"24.3")
252 (temporary-file-directory
253 ;; Darwin section added 24.1, does not seem worth :version bump.
256 (file-name-as-directory
257 ;; FIXME ? Should there be Ftemporary_file_directory to do this
258 ;; more robustly (cf set_local_socket in emacsclient.c).
259 ;; It could be used elsewhere, eg Fcall_process_region,
260 ;; server-socket-dir. See bug#7135.
261 (cond ((memq system-type
'(ms-dos windows-nt
))
262 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
264 ((eq system-type
'darwin
)
265 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
267 (let ((tmp (ignore-errors
268 (shell-command-to-string
269 "getconf DARWIN_USER_TEMP_DIR"))))
271 (setq tmp
(replace-regexp-in-string
273 ;; Handles "getconf: Unrecognized variable..."
274 (file-directory-p tmp
)
278 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
280 :initialize custom-initialize-delay
)
282 (use-dialog-box menu boolean
"21.1")
283 (use-file-dialog menu boolean
"22.1")
284 (focus-follows-mouse frames boolean
"20.3")
286 ;; FIXME nil is the initial value, fontset.el setqs it.
287 (vertical-centering-font-regexp display
288 (choice (const nil
) regexp
))
290 (default-frame-alist frames
291 (repeat (cons :format
"%v"
292 (symbol :tag
"Parameter")
293 (sexp :tag
"Value"))))
294 (mouse-highlight mouse
(choice (const :tag
"disabled" nil
)
295 (const :tag
"always shown" t
)
296 (other :tag
"hidden by keypress" 1))
298 (make-pointer-invisible mouse boolean
"23.2")
299 (menu-bar-mode frames boolean nil
301 ;; :initialize custom-initialize-default
302 :set custom-set-minor-mode
)
303 (tool-bar-mode (frames mouse
) boolean nil
304 ;; :initialize custom-initialize-default
305 :set custom-set-minor-mode
)
306 (frame-resize-pixelwise frames boolean
"24.4")
307 (frame-inhibit-implied-resize frames
309 (const :tag
"Never" nil
)
310 (const :tag
"Always" t
)
311 (repeat (symbol :tag
"Parameter")))
314 (overflow-newline-into-fringe fringe boolean
)
316 (imagemagick-render-type image integer
"24.1")
318 (indent-tabs-mode indent boolean
)
320 (meta-prefix-char keyboard character
)
321 (auto-save-interval auto-save integer
)
322 (auto-save-timeout auto-save
(choice (const :tag
"off" nil
)
323 (integer :format
"%v")))
324 (echo-keystrokes minibuffer number
)
325 (polling-period keyboard integer
)
326 (double-click-time mouse
(restricted-sexp
327 :match-alternatives
(integerp 'nil
't
)))
328 (double-click-fuzz mouse integer
"22.1")
329 (help-char keyboard character
)
330 (help-event-list keyboard
(repeat (sexp :format
"%v")))
331 (menu-prompting menu boolean
)
332 (select-active-regions killing
333 (choice (const :tag
"always" t
)
334 (const :tag
"only shift-selection or mouse-drag" only
)
335 (const :tag
"off" nil
))
337 (debug-on-event debug
338 (choice (const :tag
"None" nil
)
339 (const :tag
"When sent SIGUSR1" sigusr1
)
340 (const :tag
"When sent SIGUSR2" sigusr2
))
343 ;; This is not good news because it will use the wrong
344 ;; version-specific directories when you upgrade. We need
345 ;; customization of the front of the list, maintaining the
346 ;; standard value intact at the back.
347 ;;(load-path environment
348 ;; (repeat (choice :tag "[Current dir?]"
349 ;; :format "%[Current dir?%] %v"
350 ;; (const :tag " current dir" nil)
351 ;; (directory :format "%v"))))
352 (load-prefer-newer lisp boolean
"24.4")
354 (enable-recursive-minibuffers minibuffer boolean
)
355 (history-length minibuffer
356 (choice (const :tag
"Infinite" t
) integer
)
358 (history-delete-duplicates minibuffer boolean
"22.1")
359 (read-buffer-completion-ignore-case minibuffer boolean
"23.1")
361 (minibuffer-prompt-properties
365 (const :tag
"Read-Only"
366 :doc
"Prevent prompt from being modified"
370 (const :tag
"Don't Enter"
371 :doc
"Prevent point from ever entering prompt"
374 (cursor-intangible t
)))
376 :tag
"Other Properties"
379 (symbol :tag
"Property")
380 (sexp :tag
"Value"))))
382 :set minibuffer-prompt-properties--setter
)
383 (minibuffer-auto-raise minibuffer boolean
)
384 ;; options property set at end
385 (read-buffer-function minibuffer
389 (dos-unsupported-char-glyph display integer
)
393 (choice (const :tag
"No modifier" nil
)
394 (const control
) (const meta
)
395 (const alt
) (const hyper
)
396 (const super
)) "23.1")
397 (ns-right-control-modifier
399 (choice (const :tag
"No modifier (work as control)" none
)
400 (const :tag
"Use the value of ns-control-modifier"
402 (const control
) (const meta
)
403 (const alt
) (const hyper
)
404 (const super
)) "24.1")
407 (choice (const :tag
"No modifier" nil
)
408 (const control
) (const meta
)
409 (const alt
) (const hyper
)
410 (const super
)) "23.1")
411 (ns-right-command-modifier
413 (choice (const :tag
"No modifier (work as command)" none
)
414 (const :tag
"Use the value of ns-command-modifier"
416 (const control
) (const meta
)
417 (const alt
) (const hyper
)
418 (const super
)) "24.1")
419 (ns-alternate-modifier
421 (choice (const :tag
"No modifier (work as alternate/option)" none
)
422 (const control
) (const meta
)
423 (const alt
) (const hyper
)
424 (const super
)) "23.1")
425 (ns-right-alternate-modifier
427 (choice (const :tag
"No modifier (work as alternate/option)" none
)
428 (const :tag
"Use the value of ns-alternate-modifier"
430 (const control
) (const meta
)
431 (const alt
) (const hyper
)
432 (const super
)) "23.3")
433 (ns-function-modifier
435 (choice (const :tag
"No modifier (work as function)" none
)
436 (const control
) (const meta
)
437 (const alt
) (const hyper
)
438 (const super
)) "23.1")
439 (ns-antialias-text ns boolean
"23.1")
440 (ns-auto-hide-menu-bar ns boolean
"24.1")
441 (ns-use-native-fullscreen ns boolean
"24.4")
442 (ns-use-fullscreen-animation ns boolean
"25.1")
443 (ns-use-srgb-colorspace ns boolean
"24.4")
445 (delete-exited-processes processes-basics boolean
)
447 (parse-sexp-ignore-comments editing-basics boolean
)
448 (words-include-escapes editing-basics boolean
)
449 (open-paren-in-column-0-is-defun-start editing-basics boolean
452 (visible-cursor cursor boolean
"22.1")
454 (ring-bell-function display
456 (const :tag
"Default" nil
)
457 (const :tag
"Silent" ignore
)
460 (undo-limit undo integer
)
461 (undo-strong-limit undo integer
)
462 (undo-outer-limit undo
464 (const :tag
"No limit"
468 the undo info for the current command never gets discarded.
469 This should only be chosen under exceptional circumstances,
470 since it could result in memory overflow and make Emacs crash."
474 (temp-buffer-show-function windows
(choice (const nil
) function
))
475 (next-screen-context-lines windows integer
)
476 (scroll-preserve-screen-position
478 (const :tag
"Off (nil)" :value nil
)
479 (const :tag
"Full screen (t)" :value t
)
480 (other :tag
"Always" 1)) "22.1")
483 (const :tag
"Never (nil)" :value nil
)
484 (const :tag
"Only on ttys" :value tty
)
485 (other :tag
"Always" t
)) "23.1")
486 (window-combination-resize windows boolean
"24.1")
487 (window-combination-limit
489 (const :tag
"Never (nil)" :value nil
)
490 (const :tag
"For Temp Buffer Resize mode (temp-buffer-resize)"
491 :value temp-buffer-resize
)
492 (const :tag
"For temporary buffers (temp-buffer)"
494 (const :tag
"For buffer display (display-buffer)"
495 :value display-buffer
)
496 (other :tag
"Always (t)" :value t
))
498 (fast-but-imprecise-scrolling scrolling boolean
"25.1")
499 (window-resize-pixelwise windows boolean
"24.4")
501 ;; The whitespace group is for whitespace.el.
502 (show-trailing-whitespace editing-basics boolean nil
504 (scroll-step windows integer
)
505 (scroll-conservatively windows integer
)
506 (scroll-margin windows integer
)
507 (hscroll-margin windows integer
"22.1")
508 (hscroll-step windows number
"22.1")
509 (truncate-partial-width-windows
511 (choice (integer :tag
"Truncate if narrower than")
512 (const :tag
"Respect `truncate-lines'" nil
)
513 (other :tag
"Truncate if not full-width" t
))
515 (make-cursor-line-fully-visible windows boolean
)
516 (mode-line-in-non-selected-windows mode-line boolean
"22.1")
517 (line-number-display-limit display
519 (const :tag
"No limit" nil
)))
520 (line-number-display-limit-width display integer
"22.1")
521 (highlight-nonselected-windows display boolean
)
522 (message-log-max debug
(choice (const :tag
"Disable" nil
)
523 (integer :menu-tag
"lines"
525 (other :tag
"Unlimited" t
))
527 (unibyte-display-via-language-environment mule boolean
)
528 (blink-cursor-alist cursor alist
"22.1")
529 (overline-margin display integer
"22.1")
530 (underline-minimum-offset display integer
"23.1")
531 (mouse-autoselect-window
533 (const :tag
"Off (nil)" :value nil
)
534 (const :tag
"Immediate" :value t
)
535 (number :tag
"Delay by secs" :value
0.5)) "22.1")
538 (const :tag
"Images" :value image
)
539 (const :tag
"Text" :value text
)
540 (const :tag
"Both" :value both
)
541 (const :tag
"Both-horiz" :value both-horiz
)
542 (const :tag
"Text-image-horiz" :value text-image-horiz
)
543 (const :tag
"System default" :value nil
)) "24.1")
544 (tool-bar-max-label-size frames integer
"24.1")
545 (auto-hscroll-mode scrolling boolean
"21.1")
546 (void-text-area-pointer cursor
548 (const :tag
"Standard (text pointer)" :value nil
)
549 (const :tag
"Arrow" :value arrow
)
550 (const :tag
"Text pointer" :value text
)
551 (const :tag
"Hand" :value hand
)
552 (const :tag
"Vertical dragger" :value vdrag
)
553 (const :tag
"Horizontal dragger" :value hdrag
)
554 (const :tag
"Same as mode line" :value modeline
)
555 (const :tag
"Hourglass" :value hourglass
)))
556 (display-hourglass cursor boolean
)
557 (hourglass-delay cursor number
)
560 (const :tag
"Off (nil)" :value nil
)
561 (const :tag
"Fit (t)" :value t
)
562 (const :tag
"Grow only" :value grow-only
))
565 (scalable-fonts-allowed display boolean
"22.1")
567 (x-bitmap-file-path installation
568 (repeat (directory :format
"%v")))
569 (x-gtk-use-old-file-dialog menu boolean
"22.1")
570 (x-gtk-show-hidden-files menu boolean
"22.1")
571 (x-gtk-file-dialog-help-text menu boolean
"22.1")
572 (x-gtk-use-system-tooltips tooltip boolean
"23.3")
574 (x-use-underline-position-properties display boolean
"22.1")
575 (x-underline-at-descent-line display boolean
"22.1")
576 (x-stretch-cursor display boolean
"21.1")
577 (scroll-bar-adjust-thumb-portion windows boolean
"24.4")
579 (x-select-enable-clipboard-manager killing boolean
"24.1")
581 (font-use-system-font font-selection boolean
"23.2")))
582 (setq ;; If we did not specify any standard value expression above,
583 ;; use the current value as the standard value.
584 standard
(if (setq prop
(memq :standard rest
))
586 (if (default-boundp symbol
)
587 (funcall quoter
(default-value symbol
))))
588 ;; Don't complain about missing variables which are
589 ;; irrelevant to this platform.
590 native-p
(save-match-data
592 ((string-match "\\`dos-" (symbol-name symbol
))
593 (eq system-type
'ms-dos
))
594 ((string-match "\\`w32-" (symbol-name symbol
))
595 (eq system-type
'windows-nt
))
596 ((string-match "\\`ns-" (symbol-name symbol
))
598 ((string-match "\\`x-.*gtk" (symbol-name symbol
))
600 ((string-match "clipboard-manager" (symbol-name symbol
))
601 (boundp 'x-select-enable-clipboard-manager
))
602 ((string-match "\\`x-" (symbol-name symbol
))
603 (fboundp 'x-create-frame
))
604 ((string-match "selection" (symbol-name symbol
))
605 (fboundp 'x-selection-exists-p
))
606 ((string-match "fringe" (symbol-name symbol
))
607 (fboundp 'define-fringe-bitmap
))
608 ((string-match "\\`imagemagick" (symbol-name symbol
))
609 (fboundp 'imagemagick-types
))
610 ((equal "font-use-system-font" (symbol-name symbol
))
611 (featurep 'system-font-setting
))
612 ;; Conditioned on x-create-frame, because that's
613 ;; the condition for loadup.el to preload tool-bar.el.
614 ((string-match "tool-bar-" (symbol-name symbol
))
615 (fboundp 'x-create-frame
))
616 ((equal "vertical-centering-font-regexp"
617 (symbol-name symbol
))
618 ;; Any function from fontset.c will do.
619 (fboundp 'new-fontset
))
620 ((equal "scroll-bar-adjust-thumb-portion"
621 (symbol-name symbol
))
624 (if (not (boundp symbol
))
625 ;; If variables are removed from C code, give an error here!
627 (message "Note, built-in variable `%S' not bound" symbol
))
628 ;; Save the standard value, unless we already did.
629 (or (get symbol
'standard-value
)
630 (put symbol
'standard-value
(list standard
)))
631 ;; We need these properties independent of whether cus-start is loaded.
632 (if (setq prop
(memq :safe rest
))
633 (put symbol
'safe-local-variable
(cadr prop
)))
634 (if (setq prop
(memq :risky rest
))
635 (put symbol
'risky-local-variable
(cadr prop
)))
636 (if (setq prop
(memq :set rest
))
637 (put symbol
'custom-set
(cadr prop
)))
638 ;; Note this is the _only_ initialize property we handle.
639 (if (eq (cadr (memq :initialize rest
)) 'custom-initialize-delay
)
640 ;; These vars are defined early and should hence be initialized
641 ;; early, even if this file happens to be loaded late. so add them
642 ;; to the end of custom-delayed-init-variables. Otherwise,
643 ;; auto-save-file-name-transforms will appear in M-x customize-rogue.
644 (add-to-list 'custom-delayed-init-variables symbol
'append
))
645 ;; If this is NOT while dumping Emacs, set up the rest of the
646 ;; customization info. This is the stuff that is not needed
647 ;; until someone does M-x customize etc.
649 ;; Add it to the right group(s).
652 (custom-add-to-group g symbol
'custom-variable
))
653 (custom-add-to-group group symbol
'custom-variable
))
655 (put symbol
'custom-type type
)
656 (if version
(put symbol
'custom-version version
))
658 (setq prop
(car rest
)
660 rest
(nthcdr 2 rest
))
661 (cond ((memq prop
'(:standard
:risky
:safe
:set
))) ; handled above
663 (put symbol
'custom-tag propval
))))))))
665 (custom-add-to-group 'font-lock
'open-paren-in-column-0-is-defun-start
668 ;; Record cus-start as loaded if we have set up all the info that we can.
669 ;; Don't record it as loaded if we have only set up the standard values
670 ;; and safe/risky properties.
672 (provide 'cus-start
))
674 ;;; cus-start.el ends here