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