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 (enable-character-translation mule boolean
)
185 (eol-mnemonic-undecided mule string
)
186 ;; startup.el fiddles with the values. IMO, would be
187 ;; simpler to just use #ifdefs in coding.c.
188 (eol-mnemonic-unix mule string nil
190 (if (memq system-type
'(ms-dos windows-nt
))
192 (eol-mnemonic-dos mule string nil
194 (if (memq system-type
'(ms-dos windows-nt
))
196 (eol-mnemonic-mac mule string nil
198 (file-coding-system-alist
201 :key-type
(regexp :tag
"File regexp")
203 :value
(undecided . undecided
)
204 (cons :tag
"Encoding/decoding pair"
205 :value
(undecided . undecided
)
206 (coding-system :tag
"Decoding")
207 (coding-system :tag
"Encoding"))
209 :tag
"Single coding system"
211 :match
(lambda (widget value
)
212 (and value
(not (functionp value
)))))
213 (function :value ignore
))))
215 (completion-ignored-extensions dired
216 (repeat (string :format
"%v")))
218 (baud-rate display integer
)
219 (inverse-video display boolean
)
220 (visible-bell display boolean
)
221 (no-redraw-on-reenter display boolean
)
224 (dos-display-scancodes display boolean
)
225 (dos-hyper-key keyboard integer
)
226 (dos-super-key keyboard integer
)
227 (dos-keypad-mode keyboard integer
)
230 (user-full-name mail string
)
232 (report-emacs-bug-address emacsbug string
)
234 (max-specpdl-size limits integer
)
235 (max-lisp-eval-depth limits integer
)
236 (max-mini-window-height limits
237 (choice (const :tag
"quarter screen" nil
)
239 (debug-on-error debug
240 (choice (const :tag
"off")
241 (repeat :menu-tag
"When"
243 (symbol :format
"%v"))
244 (const :tag
"always" t
)))
245 (debug-ignored-errors debug
(repeat (choice symbol regexp
)))
246 (debug-on-quit debug boolean
)
247 (debug-on-signal debug boolean
)
249 (delete-by-moving-to-trash auto-save boolean
"23.1")
250 (auto-save-visited-file-name auto-save boolean
)
252 (create-lockfiles files boolean
"24.3")
253 (temporary-file-directory
254 ;; Darwin section added 24.1, does not seem worth :version bump.
257 (file-name-as-directory
258 ;; FIXME ? Should there be Ftemporary_file_directory to do this
259 ;; more robustly (cf set_local_socket in emacsclient.c).
260 ;; It could be used elsewhere, eg Fcall_process_region,
261 ;; server-socket-dir. See bug#7135.
262 (cond ((memq system-type
'(ms-dos windows-nt
))
263 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
265 ((eq system-type
'darwin
)
266 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
268 (let ((tmp (ignore-errors
269 (shell-command-to-string
270 "getconf DARWIN_USER_TEMP_DIR"))))
272 (setq tmp
(replace-regexp-in-string
274 ;; Handles "getconf: Unrecognized variable..."
275 (file-directory-p tmp
)
279 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
281 :initialize custom-initialize-delay
)
283 (use-dialog-box menu boolean
"21.1")
284 (use-file-dialog menu boolean
"22.1")
285 (focus-follows-mouse frames boolean
"20.3")
287 ;; FIXME nil is the initial value, fontset.el setqs it.
288 (vertical-centering-font-regexp display
289 (choice (const nil
) regexp
))
291 (default-frame-alist frames
292 (repeat (cons :format
"%v"
293 (symbol :tag
"Parameter")
294 (sexp :tag
"Value"))))
295 (mouse-highlight mouse
(choice (const :tag
"disabled" nil
)
296 (const :tag
"always shown" t
)
297 (other :tag
"hidden by keypress" 1))
299 (make-pointer-invisible mouse boolean
"23.2")
300 (menu-bar-mode frames boolean nil
302 ;; :initialize custom-initialize-default
303 :set custom-set-minor-mode
)
304 (tool-bar-mode (frames mouse
) boolean nil
305 ;; :initialize custom-initialize-default
306 :set custom-set-minor-mode
)
307 (frame-resize-pixelwise frames boolean
"24.4")
308 (frame-inhibit-implied-resize frames
310 (const :tag
"Never" nil
)
311 (const :tag
"Always" t
)
312 (repeat (symbol :tag
"Parameter")))
315 (overflow-newline-into-fringe fringe boolean
)
317 (imagemagick-render-type image integer
"24.1")
319 (indent-tabs-mode indent boolean
)
321 (meta-prefix-char keyboard character
)
322 (auto-save-interval auto-save integer
)
323 (auto-save-timeout auto-save
(choice (const :tag
"off" nil
)
324 (integer :format
"%v")))
325 (echo-keystrokes minibuffer number
)
326 (polling-period keyboard integer
)
327 (double-click-time mouse
(restricted-sexp
328 :match-alternatives
(integerp 'nil
't
)))
329 (double-click-fuzz mouse integer
"22.1")
330 (help-char keyboard character
)
331 (help-event-list keyboard
(repeat (sexp :format
"%v")))
332 (menu-prompting menu boolean
)
333 (select-active-regions killing
334 (choice (const :tag
"always" t
)
335 (const :tag
"only shift-selection or mouse-drag" only
)
336 (const :tag
"off" nil
))
338 (debug-on-event debug
339 (choice (const :tag
"None" nil
)
340 (const :tag
"When sent SIGUSR1" sigusr1
)
341 (const :tag
"When sent SIGUSR2" sigusr2
))
344 ;; This is not good news because it will use the wrong
345 ;; version-specific directories when you upgrade. We need
346 ;; customization of the front of the list, maintaining the
347 ;; standard value intact at the back.
348 ;;(load-path environment
349 ;; (repeat (choice :tag "[Current dir?]"
350 ;; :format "%[Current dir?%] %v"
351 ;; (const :tag " current dir" nil)
352 ;; (directory :format "%v"))))
353 (load-prefer-newer lisp boolean
"24.4")
355 (enable-recursive-minibuffers minibuffer boolean
)
356 (history-length minibuffer
357 (choice (const :tag
"Infinite" t
) integer
)
359 (history-delete-duplicates minibuffer boolean
"22.1")
360 (read-buffer-completion-ignore-case minibuffer boolean
"23.1")
362 (minibuffer-prompt-properties
366 (const :tag
"Read-Only"
367 :doc
"Prevent prompt from being modified"
371 (const :tag
"Don't Enter"
372 :doc
"Prevent point from ever entering prompt"
375 (cursor-intangible t
)))
377 :tag
"Other Properties"
380 (symbol :tag
"Property")
381 (sexp :tag
"Value"))))
383 :set minibuffer-prompt-properties--setter
)
384 (minibuffer-auto-raise minibuffer boolean
)
385 ;; options property set at end
386 (read-buffer-function minibuffer
390 (dos-unsupported-char-glyph display integer
)
394 (choice (const :tag
"No modifier" nil
)
395 (const control
) (const meta
)
396 (const alt
) (const hyper
)
397 (const super
)) "23.1")
398 (ns-right-control-modifier
400 (choice (const :tag
"No modifier (work as control)" none
)
401 (const :tag
"Use the value of ns-control-modifier"
403 (const control
) (const meta
)
404 (const alt
) (const hyper
)
405 (const super
)) "24.1")
408 (choice (const :tag
"No modifier" nil
)
409 (const control
) (const meta
)
410 (const alt
) (const hyper
)
411 (const super
)) "23.1")
412 (ns-right-command-modifier
414 (choice (const :tag
"No modifier (work as command)" none
)
415 (const :tag
"Use the value of ns-command-modifier"
417 (const control
) (const meta
)
418 (const alt
) (const hyper
)
419 (const super
)) "24.1")
420 (ns-alternate-modifier
422 (choice (const :tag
"No modifier (work as alternate/option)" none
)
423 (const control
) (const meta
)
424 (const alt
) (const hyper
)
425 (const super
)) "23.1")
426 (ns-right-alternate-modifier
428 (choice (const :tag
"No modifier (work as alternate/option)" none
)
429 (const :tag
"Use the value of ns-alternate-modifier"
431 (const control
) (const meta
)
432 (const alt
) (const hyper
)
433 (const super
)) "23.3")
434 (ns-function-modifier
436 (choice (const :tag
"No modifier (work as function)" none
)
437 (const control
) (const meta
)
438 (const alt
) (const hyper
)
439 (const super
)) "23.1")
440 (ns-antialias-text ns boolean
"23.1")
441 (ns-auto-hide-menu-bar ns boolean
"24.1")
442 (ns-confirm-quit ns boolean
"25.1")
443 (ns-use-native-fullscreen ns boolean
"24.4")
444 (ns-use-fullscreen-animation ns boolean
"25.1")
445 (ns-use-srgb-colorspace ns boolean
"24.4")
447 (delete-exited-processes processes-basics boolean
)
449 (parse-sexp-ignore-comments editing-basics boolean
)
450 (words-include-escapes editing-basics boolean
)
451 (open-paren-in-column-0-is-defun-start editing-basics boolean
454 (visible-cursor cursor boolean
"22.1")
456 (ring-bell-function display
458 (const :tag
"Default" nil
)
459 (const :tag
"Silent" ignore
)
462 (undo-limit undo integer
)
463 (undo-strong-limit undo integer
)
464 (undo-outer-limit undo
466 (const :tag
"No limit"
470 the undo info for the current command never gets discarded.
471 This should only be chosen under exceptional circumstances,
472 since it could result in memory overflow and make Emacs crash."
476 (temp-buffer-show-function windows
(choice (const nil
) function
))
477 (next-screen-context-lines windows integer
)
478 (scroll-preserve-screen-position
480 (const :tag
"Off (nil)" :value nil
)
481 (const :tag
"Full screen (t)" :value t
)
482 (other :tag
"Always" 1)) "22.1")
485 (const :tag
"Never (nil)" :value nil
)
486 (const :tag
"Only on ttys" :value tty
)
487 (other :tag
"Always" t
)) "23.1")
488 (window-combination-resize windows boolean
"24.1")
489 (window-combination-limit
491 (const :tag
"Never (nil)" :value nil
)
492 (const :tag
"For Temp Buffer Resize mode (temp-buffer-resize)"
493 :value temp-buffer-resize
)
494 (const :tag
"For temporary buffers (temp-buffer)"
496 (const :tag
"For buffer display (display-buffer)"
497 :value display-buffer
)
498 (other :tag
"Always (t)" :value t
))
500 (fast-but-imprecise-scrolling scrolling boolean
"25.1")
501 (window-resize-pixelwise windows boolean
"24.4")
503 ;; The whitespace group is for whitespace.el.
504 (show-trailing-whitespace editing-basics boolean nil
506 (scroll-step windows integer
)
507 (scroll-conservatively windows integer
)
508 (scroll-margin windows integer
)
509 (hscroll-margin windows integer
"22.1")
510 (hscroll-step windows number
"22.1")
511 (truncate-partial-width-windows
513 (choice (integer :tag
"Truncate if narrower than")
514 (const :tag
"Respect `truncate-lines'" nil
)
515 (other :tag
"Truncate if not full-width" t
))
517 (make-cursor-line-fully-visible windows boolean
)
518 (mode-line-in-non-selected-windows mode-line boolean
"22.1")
519 (line-number-display-limit display
521 (const :tag
"No limit" nil
)))
522 (line-number-display-limit-width display integer
"22.1")
523 (highlight-nonselected-windows display boolean
)
524 (message-log-max debug
(choice (const :tag
"Disable" nil
)
525 (integer :menu-tag
"lines"
527 (other :tag
"Unlimited" t
))
529 (unibyte-display-via-language-environment mule boolean
)
530 (blink-cursor-alist cursor alist
"22.1")
531 (overline-margin display integer
"22.1")
532 (underline-minimum-offset display integer
"23.1")
533 (mouse-autoselect-window
535 (const :tag
"Off (nil)" :value nil
)
536 (const :tag
"Immediate" :value t
)
537 (number :tag
"Delay by secs" :value
0.5)) "22.1")
540 (const :tag
"Images" :value image
)
541 (const :tag
"Text" :value text
)
542 (const :tag
"Both" :value both
)
543 (const :tag
"Both-horiz" :value both-horiz
)
544 (const :tag
"Text-image-horiz" :value text-image-horiz
)
545 (const :tag
"System default" :value nil
)) "24.1")
546 (tool-bar-max-label-size frames integer
"24.1")
547 (auto-hscroll-mode scrolling boolean
"21.1")
548 (void-text-area-pointer cursor
550 (const :tag
"Standard (text pointer)" :value nil
)
551 (const :tag
"Arrow" :value arrow
)
552 (const :tag
"Text pointer" :value text
)
553 (const :tag
"Hand" :value hand
)
554 (const :tag
"Vertical dragger" :value vdrag
)
555 (const :tag
"Horizontal dragger" :value hdrag
)
556 (const :tag
"Same as mode line" :value modeline
)
557 (const :tag
"Hourglass" :value hourglass
)))
558 (display-hourglass cursor boolean
)
559 (hourglass-delay cursor number
)
562 (const :tag
"Off (nil)" :value nil
)
563 (const :tag
"Fit (t)" :value t
)
564 (const :tag
"Grow only" :value grow-only
))
567 (scalable-fonts-allowed display boolean
"22.1")
569 (x-bitmap-file-path installation
570 (repeat (directory :format
"%v")))
571 (x-gtk-use-old-file-dialog menu boolean
"22.1")
572 (x-gtk-show-hidden-files menu boolean
"22.1")
573 (x-gtk-file-dialog-help-text menu boolean
"22.1")
574 (x-gtk-use-system-tooltips tooltip boolean
"23.3")
576 (x-use-underline-position-properties display boolean
"22.1")
577 (x-underline-at-descent-line display boolean
"22.1")
578 (x-stretch-cursor display boolean
"21.1")
579 (scroll-bar-adjust-thumb-portion windows boolean
"24.4")
581 (x-select-enable-clipboard-manager killing boolean
"24.1")
583 (font-use-system-font font-selection boolean
"23.2")))
584 (setq ;; If we did not specify any standard value expression above,
585 ;; use the current value as the standard value.
586 standard
(if (setq prop
(memq :standard rest
))
588 (if (default-boundp symbol
)
589 (funcall quoter
(default-value symbol
))))
590 ;; Don't complain about missing variables which are
591 ;; irrelevant to this platform.
592 native-p
(save-match-data
594 ((string-match "\\`dos-" (symbol-name symbol
))
595 (eq system-type
'ms-dos
))
596 ((string-match "\\`w32-" (symbol-name symbol
))
597 (eq system-type
'windows-nt
))
598 ((string-match "\\`ns-" (symbol-name symbol
))
600 ((string-match "\\`x-.*gtk" (symbol-name symbol
))
602 ((string-match "clipboard-manager" (symbol-name symbol
))
603 (boundp 'x-select-enable-clipboard-manager
))
604 ((string-match "\\`x-" (symbol-name symbol
))
605 (fboundp 'x-create-frame
))
606 ((string-match "selection" (symbol-name symbol
))
607 (fboundp 'x-selection-exists-p
))
608 ((string-match "fringe" (symbol-name symbol
))
609 (fboundp 'define-fringe-bitmap
))
610 ((string-match "\\`imagemagick" (symbol-name symbol
))
611 (fboundp 'imagemagick-types
))
612 ((equal "font-use-system-font" (symbol-name symbol
))
613 (featurep 'system-font-setting
))
614 ;; Conditioned on x-create-frame, because that's
615 ;; the condition for loadup.el to preload tool-bar.el.
616 ((string-match "tool-bar-" (symbol-name symbol
))
617 (fboundp 'x-create-frame
))
618 ((equal "vertical-centering-font-regexp"
619 (symbol-name symbol
))
620 ;; Any function from fontset.c will do.
621 (fboundp 'new-fontset
))
622 ((equal "scroll-bar-adjust-thumb-portion"
623 (symbol-name symbol
))
626 (if (not (boundp symbol
))
627 ;; If variables are removed from C code, give an error here!
629 (message "Note, built-in variable ‘%S’ not bound" symbol
))
630 ;; Save the standard value, unless we already did.
631 (or (get symbol
'standard-value
)
632 (put symbol
'standard-value
(list standard
)))
633 ;; We need these properties independent of whether cus-start is loaded.
634 (if (setq prop
(memq :safe rest
))
635 (put symbol
'safe-local-variable
(cadr prop
)))
636 (if (setq prop
(memq :risky rest
))
637 (put symbol
'risky-local-variable
(cadr prop
)))
638 (if (setq prop
(memq :set rest
))
639 (put symbol
'custom-set
(cadr prop
)))
640 ;; Note this is the _only_ initialize property we handle.
641 (if (eq (cadr (memq :initialize rest
)) 'custom-initialize-delay
)
642 ;; These vars are defined early and should hence be initialized
643 ;; early, even if this file happens to be loaded late. so add them
644 ;; to the end of custom-delayed-init-variables. Otherwise,
645 ;; auto-save-file-name-transforms will appear in M-x customize-rogue.
646 (add-to-list 'custom-delayed-init-variables symbol
'append
))
647 ;; If this is NOT while dumping Emacs, set up the rest of the
648 ;; customization info. This is the stuff that is not needed
649 ;; until someone does M-x customize etc.
651 ;; Add it to the right group(s).
654 (custom-add-to-group g symbol
'custom-variable
))
655 (custom-add-to-group group symbol
'custom-variable
))
657 (put symbol
'custom-type type
)
658 (if version
(put symbol
'custom-version version
))
660 (setq prop
(car rest
)
662 rest
(nthcdr 2 rest
))
663 (cond ((memq prop
'(:standard
:risky
:safe
:set
))) ; handled above
665 (put symbol
'custom-tag propval
))))))))
667 (custom-add-to-group 'font-lock
'open-paren-in-column-0-is-defun-start
670 ;; Record cus-start as loaded if we have set up all the info that we can.
671 ;; Don't record it as loaded if we have only set up the standard values
672 ;; and safe/risky properties.
674 (provide 'cus-start
))
676 ;;; cus-start.el ends here