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")))
176 (mapcar 'directory-file-name
177 (append (parse-colon-path (getenv "PATH"))
178 (list exec-directory
))))
179 (exec-suffixes execute
(repeat string
))
181 (charset-map-path installation
182 (repeat (directory :format
"%v")))
184 (inhibit-eol-conversion mule boolean
)
185 (enable-character-translation mule boolean
)
186 (eol-mnemonic-undecided mule string
)
187 ;; startup.el fiddles with the values. IMO, would be
188 ;; simpler to just use #ifdefs in coding.c.
189 (eol-mnemonic-unix mule string nil
191 (if (memq system-type
'(ms-dos windows-nt
))
193 (eol-mnemonic-dos mule string nil
195 (if (memq system-type
'(ms-dos windows-nt
))
197 (eol-mnemonic-mac mule string nil
199 (file-coding-system-alist
202 :key-type
(regexp :tag
"File regexp")
204 :value
(undecided . undecided
)
205 (cons :tag
"Encoding/decoding pair"
206 :value
(undecided . undecided
)
207 (coding-system :tag
"Decoding")
208 (coding-system :tag
"Encoding"))
210 :tag
"Single coding system"
212 :match
(lambda (widget value
)
213 (and value
(not (functionp value
)))))
214 (function :value ignore
))))
216 (completion-ignored-extensions dired
217 (repeat (string :format
"%v")))
219 (baud-rate display integer
)
220 (inverse-video display boolean
)
221 (visible-bell display boolean
)
222 (no-redraw-on-reenter display boolean
)
225 (dos-display-scancodes display boolean
)
226 (dos-hyper-key keyboard integer
)
227 (dos-super-key keyboard integer
)
228 (dos-keypad-mode keyboard integer
)
231 (user-full-name mail string
)
233 (report-emacs-bug-address emacsbug string
)
235 (max-specpdl-size limits integer
)
236 (max-lisp-eval-depth limits integer
)
237 (max-mini-window-height limits
238 (choice (const :tag
"quarter screen" nil
)
240 (debug-on-error debug
241 (choice (const :tag
"off")
242 (repeat :menu-tag
"When"
244 (symbol :format
"%v"))
245 (const :tag
"always" t
)))
246 (debug-ignored-errors debug
(repeat (choice symbol regexp
)))
247 (debug-on-quit debug boolean
)
248 (debug-on-signal debug boolean
)
250 (delete-by-moving-to-trash auto-save boolean
"23.1")
251 (auto-save-visited-file-name auto-save boolean
)
253 (create-lockfiles files boolean
"24.3")
254 (temporary-file-directory
255 ;; Darwin section added 24.1, does not seem worth :version bump.
258 (file-name-as-directory
259 ;; FIXME ? Should there be Ftemporary_file_directory to do this
260 ;; more robustly (cf set_local_socket in emacsclient.c).
261 ;; It could be used elsewhere, eg Fcall_process_region,
262 ;; server-socket-dir. See bug#7135.
263 (cond ((memq system-type
'(ms-dos windows-nt
))
264 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
266 ((eq system-type
'darwin
)
267 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
269 (let ((tmp (ignore-errors
270 (shell-command-to-string
271 "getconf DARWIN_USER_TEMP_DIR"))))
273 (setq tmp
(replace-regexp-in-string
275 ;; Handles "getconf: Unrecognized variable..."
276 (file-directory-p tmp
)
280 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
282 :initialize custom-initialize-delay
)
284 (use-dialog-box menu boolean
"21.1")
285 (use-file-dialog menu boolean
"22.1")
286 (focus-follows-mouse frames boolean
"20.3")
288 ;; FIXME nil is the initial value, fontset.el setqs it.
289 (vertical-centering-font-regexp display
290 (choice (const nil
) regexp
))
292 (default-frame-alist frames
293 (repeat (cons :format
"%v"
294 (symbol :tag
"Parameter")
295 (sexp :tag
"Value"))))
296 (mouse-highlight mouse
(choice (const :tag
"disabled" nil
)
297 (const :tag
"always shown" t
)
298 (other :tag
"hidden by keypress" 1))
300 (make-pointer-invisible mouse boolean
"23.2")
301 (menu-bar-mode frames boolean nil
303 ;; :initialize custom-initialize-default
304 :set custom-set-minor-mode
)
305 (tool-bar-mode (frames mouse
) boolean nil
306 ;; :initialize custom-initialize-default
307 :set custom-set-minor-mode
)
308 (frame-resize-pixelwise frames boolean
"24.4")
309 (frame-inhibit-implied-resize frames
311 (const :tag
"Never" nil
)
312 (const :tag
"Always" t
)
313 (repeat (symbol :tag
"Parameter")))
316 (overflow-newline-into-fringe fringe boolean
)
318 (imagemagick-render-type image integer
"24.1")
320 (indent-tabs-mode indent boolean
)
322 (meta-prefix-char keyboard character
)
323 (auto-save-interval auto-save integer
)
324 (auto-save-timeout auto-save
(choice (const :tag
"off" nil
)
325 (integer :format
"%v")))
326 (echo-keystrokes minibuffer number
)
327 (polling-period keyboard integer
)
328 (double-click-time mouse
(restricted-sexp
329 :match-alternatives
(integerp 'nil
't
)))
330 (double-click-fuzz mouse integer
"22.1")
331 (help-char keyboard character
)
332 (help-event-list keyboard
(repeat (sexp :format
"%v")))
333 (menu-prompting menu boolean
)
334 (select-active-regions killing
335 (choice (const :tag
"always" t
)
336 (const :tag
"only shift-selection or mouse-drag" only
)
337 (const :tag
"off" nil
))
339 (debug-on-event debug
340 (choice (const :tag
"None" nil
)
341 (const :tag
"When sent SIGUSR1" sigusr1
)
342 (const :tag
"When sent SIGUSR2" sigusr2
))
345 ;; This is not good news because it will use the wrong
346 ;; version-specific directories when you upgrade. We need
347 ;; customization of the front of the list, maintaining the
348 ;; standard value intact at the back.
349 ;;(load-path environment
350 ;; (repeat (choice :tag "[Current dir?]"
351 ;; :format "%[Current dir?%] %v"
352 ;; (const :tag " current dir" nil)
353 ;; (directory :format "%v"))))
354 (load-prefer-newer lisp boolean
"24.4")
356 (enable-recursive-minibuffers minibuffer boolean
)
357 (history-length minibuffer
358 (choice (const :tag
"Infinite" t
) integer
)
360 (history-delete-duplicates minibuffer boolean
"22.1")
361 (read-buffer-completion-ignore-case minibuffer boolean
"23.1")
363 (minibuffer-prompt-properties
367 (const :tag
"Read-Only"
368 :doc
"Prevent prompt from being modified"
372 (const :tag
"Don't Enter"
373 :doc
"Prevent point from ever entering prompt"
376 (cursor-intangible t
)))
378 :tag
"Other Properties"
381 (symbol :tag
"Property")
382 (sexp :tag
"Value"))))
384 :set minibuffer-prompt-properties--setter
)
385 (minibuffer-auto-raise minibuffer boolean
)
386 ;; options property set at end
387 (read-buffer-function minibuffer
391 (dos-unsupported-char-glyph display integer
)
395 (choice (const :tag
"No modifier" nil
)
396 (const control
) (const meta
)
397 (const alt
) (const hyper
)
398 (const super
)) "23.1")
399 (ns-right-control-modifier
401 (choice (const :tag
"No modifier (work as control)" none
)
402 (const :tag
"Use the value of ns-control-modifier"
404 (const control
) (const meta
)
405 (const alt
) (const hyper
)
406 (const super
)) "24.1")
409 (choice (const :tag
"No modifier" nil
)
410 (const control
) (const meta
)
411 (const alt
) (const hyper
)
412 (const super
)) "23.1")
413 (ns-right-command-modifier
415 (choice (const :tag
"No modifier (work as command)" none
)
416 (const :tag
"Use the value of ns-command-modifier"
418 (const control
) (const meta
)
419 (const alt
) (const hyper
)
420 (const super
)) "24.1")
421 (ns-alternate-modifier
423 (choice (const :tag
"No modifier (work as alternate/option)" none
)
424 (const control
) (const meta
)
425 (const alt
) (const hyper
)
426 (const super
)) "23.1")
427 (ns-right-alternate-modifier
429 (choice (const :tag
"No modifier (work as alternate/option)" none
)
430 (const :tag
"Use the value of ns-alternate-modifier"
432 (const control
) (const meta
)
433 (const alt
) (const hyper
)
434 (const super
)) "23.3")
435 (ns-function-modifier
437 (choice (const :tag
"No modifier (work as function)" none
)
438 (const control
) (const meta
)
439 (const alt
) (const hyper
)
440 (const super
)) "23.1")
441 (ns-antialias-text ns boolean
"23.1")
442 (ns-auto-hide-menu-bar ns boolean
"24.1")
443 (ns-confirm-quit ns boolean
"25.1")
444 (ns-use-native-fullscreen ns boolean
"24.4")
445 (ns-use-fullscreen-animation ns boolean
"25.1")
446 (ns-use-srgb-colorspace ns boolean
"24.4")
448 (delete-exited-processes processes-basics boolean
)
450 (parse-sexp-ignore-comments editing-basics boolean
)
451 (words-include-escapes editing-basics boolean
)
452 (open-paren-in-column-0-is-defun-start editing-basics boolean
455 (visible-cursor cursor boolean
"22.1")
457 (ring-bell-function display
459 (const :tag
"Default" nil
)
460 (const :tag
"Silent" ignore
)
463 (undo-limit undo integer
)
464 (undo-strong-limit undo integer
)
465 (undo-outer-limit undo
467 (const :tag
"No limit"
471 the undo info for the current command never gets discarded.
472 This should only be chosen under exceptional circumstances,
473 since it could result in memory overflow and make Emacs crash."
477 (temp-buffer-show-function windows
(choice (const nil
) function
))
478 (next-screen-context-lines windows integer
)
479 (scroll-preserve-screen-position
481 (const :tag
"Off (nil)" :value nil
)
482 (const :tag
"Full screen (t)" :value t
)
483 (other :tag
"Always" 1)) "22.1")
486 (const :tag
"Never (nil)" :value nil
)
487 (const :tag
"Only on ttys" :value tty
)
488 (other :tag
"Always" t
)) "23.1")
489 (window-combination-resize windows boolean
"24.1")
490 (window-combination-limit
492 (const :tag
"Never (nil)" :value nil
)
493 (const :tag
"For Temp Buffer Resize mode (temp-buffer-resize)"
494 :value temp-buffer-resize
)
495 (const :tag
"For temporary buffers (temp-buffer)"
497 (const :tag
"For buffer display (display-buffer)"
498 :value display-buffer
)
499 (other :tag
"Always (t)" :value t
))
501 (fast-but-imprecise-scrolling scrolling boolean
"25.1")
502 (window-resize-pixelwise windows boolean
"24.4")
504 ;; The whitespace group is for whitespace.el.
505 (show-trailing-whitespace editing-basics boolean nil
507 (scroll-step windows integer
)
508 (scroll-conservatively windows integer
)
509 (scroll-margin windows integer
)
510 (hscroll-margin windows integer
"22.1")
511 (hscroll-step windows number
"22.1")
512 (truncate-partial-width-windows
514 (choice (integer :tag
"Truncate if narrower than")
515 (const :tag
"Respect `truncate-lines'" nil
)
516 (other :tag
"Truncate if not full-width" t
))
518 (make-cursor-line-fully-visible windows boolean
)
519 (mode-line-in-non-selected-windows mode-line boolean
"22.1")
520 (line-number-display-limit display
522 (const :tag
"No limit" nil
)))
523 (line-number-display-limit-width display integer
"22.1")
524 (highlight-nonselected-windows display boolean
)
525 (message-log-max debug
(choice (const :tag
"Disable" nil
)
526 (integer :menu-tag
"lines"
528 (other :tag
"Unlimited" t
))
530 (unibyte-display-via-language-environment mule boolean
)
531 (blink-cursor-alist cursor alist
"22.1")
532 (overline-margin display integer
"22.1")
533 (underline-minimum-offset display integer
"23.1")
534 (mouse-autoselect-window
536 (const :tag
"Off (nil)" :value nil
)
537 (const :tag
"Immediate" :value t
)
538 (number :tag
"Delay by secs" :value
0.5)) "22.1")
541 (const :tag
"Images" :value image
)
542 (const :tag
"Text" :value text
)
543 (const :tag
"Both" :value both
)
544 (const :tag
"Both-horiz" :value both-horiz
)
545 (const :tag
"Text-image-horiz" :value text-image-horiz
)
546 (const :tag
"System default" :value nil
)) "24.1")
547 (tool-bar-max-label-size frames integer
"24.1")
548 (auto-hscroll-mode scrolling boolean
"21.1")
549 (void-text-area-pointer cursor
551 (const :tag
"Standard (text pointer)" :value nil
)
552 (const :tag
"Arrow" :value arrow
)
553 (const :tag
"Text pointer" :value text
)
554 (const :tag
"Hand" :value hand
)
555 (const :tag
"Vertical dragger" :value vdrag
)
556 (const :tag
"Horizontal dragger" :value hdrag
)
557 (const :tag
"Same as mode line" :value modeline
)
558 (const :tag
"Hourglass" :value hourglass
)))
559 (display-hourglass cursor boolean
)
560 (hourglass-delay cursor number
)
563 (const :tag
"Off (nil)" :value nil
)
564 (const :tag
"Fit (t)" :value t
)
565 (const :tag
"Grow only" :value grow-only
))
568 (scalable-fonts-allowed display boolean
"22.1")
570 (x-bitmap-file-path installation
571 (repeat (directory :format
"%v")))
572 (x-gtk-use-old-file-dialog menu boolean
"22.1")
573 (x-gtk-show-hidden-files menu boolean
"22.1")
574 (x-gtk-file-dialog-help-text menu boolean
"22.1")
575 (x-gtk-use-system-tooltips tooltip boolean
"23.3")
577 (x-use-underline-position-properties display boolean
"22.1")
578 (x-underline-at-descent-line display boolean
"22.1")
579 (x-stretch-cursor display boolean
"21.1")
580 (scroll-bar-adjust-thumb-portion windows boolean
"24.4")
582 (x-select-enable-clipboard-manager killing boolean
"24.1")
584 (font-use-system-font font-selection boolean
"23.2")))
585 (setq ;; If we did not specify any standard value expression above,
586 ;; use the current value as the standard value.
587 standard
(if (setq prop
(memq :standard rest
))
589 (if (default-boundp symbol
)
590 (funcall quoter
(default-value symbol
))))
591 ;; Don't complain about missing variables which are
592 ;; irrelevant to this platform.
593 native-p
(save-match-data
595 ((string-match "\\`dos-" (symbol-name symbol
))
596 (eq system-type
'ms-dos
))
597 ((string-match "\\`w32-" (symbol-name symbol
))
598 (eq system-type
'windows-nt
))
599 ((string-match "\\`ns-" (symbol-name symbol
))
601 ((string-match "\\`x-.*gtk" (symbol-name symbol
))
603 ((string-match "clipboard-manager" (symbol-name symbol
))
604 (boundp 'x-select-enable-clipboard-manager
))
605 ((string-match "\\`x-" (symbol-name symbol
))
606 (fboundp 'x-create-frame
))
607 ((string-match "selection" (symbol-name symbol
))
608 (fboundp 'x-selection-exists-p
))
609 ((string-match "fringe" (symbol-name symbol
))
610 (fboundp 'define-fringe-bitmap
))
611 ((string-match "\\`imagemagick" (symbol-name symbol
))
612 (fboundp 'imagemagick-types
))
613 ((equal "font-use-system-font" (symbol-name symbol
))
614 (featurep 'system-font-setting
))
615 ;; Conditioned on x-create-frame, because that's
616 ;; the condition for loadup.el to preload tool-bar.el.
617 ((string-match "tool-bar-" (symbol-name symbol
))
618 (fboundp 'x-create-frame
))
619 ((equal "vertical-centering-font-regexp"
620 (symbol-name symbol
))
621 ;; Any function from fontset.c will do.
622 (fboundp 'new-fontset
))
623 ((equal "scroll-bar-adjust-thumb-portion"
624 (symbol-name symbol
))
627 (if (not (boundp symbol
))
628 ;; If variables are removed from C code, give an error here!
630 (message "Note, built-in variable `%S' not bound" symbol
))
631 ;; Save the standard value, unless we already did.
632 (or (get symbol
'standard-value
)
633 (put symbol
'standard-value
(list standard
)))
634 ;; We need these properties independent of whether cus-start is loaded.
635 (if (setq prop
(memq :safe rest
))
636 (put symbol
'safe-local-variable
(cadr prop
)))
637 (if (setq prop
(memq :risky rest
))
638 (put symbol
'risky-local-variable
(cadr prop
)))
639 (if (setq prop
(memq :set rest
))
640 (put symbol
'custom-set
(cadr prop
)))
641 ;; Note this is the _only_ initialize property we handle.
642 (if (eq (cadr (memq :initialize rest
)) 'custom-initialize-delay
)
643 ;; These vars are defined early and should hence be initialized
644 ;; early, even if this file happens to be loaded late. so add them
645 ;; to the end of custom-delayed-init-variables. Otherwise,
646 ;; auto-save-file-name-transforms will appear in M-x customize-rogue.
647 (add-to-list 'custom-delayed-init-variables symbol
'append
))
648 ;; If this is NOT while dumping Emacs, set up the rest of the
649 ;; customization info. This is the stuff that is not needed
650 ;; until someone does M-x customize etc.
652 ;; Add it to the right group(s).
655 (custom-add-to-group g symbol
'custom-variable
))
656 (custom-add-to-group group symbol
'custom-variable
))
658 (put symbol
'custom-type type
)
659 (if version
(put symbol
'custom-version version
))
661 (setq prop
(car rest
)
663 rest
(nthcdr 2 rest
))
664 (cond ((memq prop
'(:standard
:risky
:safe
:set
))) ; handled above
666 (put symbol
'custom-tag propval
))))))))
668 (custom-add-to-group 'font-lock
'open-paren-in-column-0-is-defun-start
671 ;; Record cus-start as loaded if we have set up all the info that we can.
672 ;; Don't record it as loaded if we have only set up the standard values
673 ;; and safe/risky properties.
675 (provide 'cus-start
))
677 ;;; cus-start.el ends here