1 ;;; cus-start.el --- define customization properties of builtins
3 ;; Copyright (C) 1997, 1999-2011 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 ;; Elements of this list have the form:
37 ;; SYMBOL GROUP TYPE VERSION REST...
38 ;; SYMBOL is the name of the variable.
39 ;; GROUP is the custom group to which it belongs (may also be a list
41 ;; TYPE is the defcustom :type.
42 ;; VERSION is the defcustom :version (or nil).
43 ;; REST is a set of :KEYWORD VALUE pairs. Accepted :KEYWORDs are:
44 ;; :standard - standard value for SYMBOL (else use current value)
45 ;; :set - custom-set property
46 ;; :risky - risky-local-variable property
47 ;; :safe - safe-local-variable property
48 ;; :tag - custom-tag property
49 (let ((all '(;; alloc.c
50 (gc-cons-threshold alloc integer
)
51 (garbage-collection-messages alloc boolean
)
53 (mode-line-format mode-line sexp
) ;Hard to do right.
54 (major-mode internal function
)
55 (case-fold-search matching boolean
)
56 (fill-column fill integer
)
57 (left-margin fill integer
)
58 (tab-width editing-basics integer
)
59 (ctl-arrow display boolean
)
60 (truncate-lines display boolean
)
61 (word-wrap display boolean
)
62 (selective-display-ellipses display boolean
)
63 (indicate-empty-lines fringe boolean
)
64 (indicate-buffer-boundaries
67 (const :tag
"No indicators" nil
)
68 (const :tag
"On left, with arrows" left
)
69 (const :tag
"On right, with arrows" right
)
70 (set :tag
"Pick your own design"
72 :format
"%{%t%}:\n%v\n%d"
73 :doc
"You can specify a default and then override it \
74 for individual indicators.
75 Leaving \"Default\" unchecked is equivalent with specifying a default of
77 (choice :tag
"Default"
79 (const :tag
"Do not show" (t . nil
))
80 (const :tag
"On the left" (t . left
))
81 (const :tag
"On the right" (t . right
)))
84 (const :tag
"Do not show" (top . nil
))
85 (const :tag
"On the left" (top . left
))
86 (const :tag
"On the right" (top . right
)))
88 :value
(bottom . left
)
89 (const :tag
"Do not show" (bottom . nil
))
90 (const :tag
"On the left" (bottom . left
))
91 (const :tag
"On the right" (bottom . right
)))
92 (choice :tag
"Up arrow"
94 (const :tag
"Do not show" (up . nil
))
95 (const :tag
"On the left" (up . left
))
96 (const :tag
"On the right" (up . right
)))
97 (choice :tag
"Down arrow"
99 (const :tag
"Do not show" (down . nil
))
100 (const :tag
"On the left" (down . left
))
101 (const :tag
"On the right" (down . right
))))
102 (other :tag
"On left, no arrows" t
)))
103 (scroll-up-aggressively windows
104 (choice (const :tag
"off" nil
) number
)
106 (scroll-down-aggressively windows
107 (choice (const :tag
"off" nil
) number
)
109 (line-spacing display
(choice (const :tag
"none" nil
) integer
)
111 (cursor-in-non-selected-windows
113 :tag
"Cursor In Non-selected Windows"
114 :set
(lambda (symbol value
)
115 (set-default symbol value
)
116 (force-mode-line-update t
)))
117 (transient-mark-mode editing-basics boolean nil
118 :standard
(not noninteractive
)
119 :initialize custom-initialize-delay
120 :set custom-set-minor-mode
)
122 (mark-even-if-inactive editing-basics boolean
)
124 (shell-file-name execute file
)
126 (repeat (choice (const :tag
"default directory" nil
)
127 (directory :format
"%v"))))
129 (charset-map-path installation
130 (repeat (directory :format
"%v")))
132 (inhibit-eol-conversion mule boolean
)
133 (eol-mnemonic-undecided mule string
)
134 (eol-mnemonic-unix mule string
)
135 (eol-mnemonic-dos mule string
)
136 (eol-mnemonic-mac mule string
)
137 (file-coding-system-alist
140 :key-type
(regexp :tag
"File regexp")
142 :value
(undecided . undecided
)
143 (cons :tag
"Encoding/decoding pair"
144 :value
(undecided . undecided
)
145 (coding-system :tag
"Decoding")
146 (coding-system :tag
"Encoding"))
148 :tag
"Single coding system"
150 :match
(lambda (widget value
)
151 (and value
(not (functionp value
)))))
152 (function :value ignore
))))
154 (completion-ignored-extensions dired
155 (repeat (string :format
"%v")))
157 (baud-rate display integer
)
158 (inverse-video display boolean
)
159 (visible-bell display boolean
)
160 (no-redraw-on-reenter display boolean
)
162 (user-full-name mail string
)
164 (max-specpdl-size limits integer
)
165 (max-lisp-eval-depth limits integer
)
166 (max-mini-window-height limits
167 (choice (const :tag
"quarter screen" nil
)
169 (debug-on-error debug
170 (choice (const :tag
"off")
171 (repeat :menu-tag
"When"
173 (symbol :format
"%v"))
174 (const :tag
"always" t
)))
175 (debug-ignored-errors debug
(repeat (choice symbol regexp
)))
177 (choice (const :tag
"off")
178 (repeat :menu-tag
"When"
180 (symbol :format
"%v"))
181 (const :tag
"always" t
)))
183 (delete-by-moving-to-trash auto-save boolean
"23.1")
184 (auto-save-visited-file-name auto-save boolean
)
186 (temporary-file-directory
187 ;; Darwin section added 24.1, does not seem worth :version bump.
190 (file-name-as-directory
191 ;; FIXME ? Should there be Ftemporary_file_directory to do this
192 ;; more robustly (cf set_local_socket in emacsclient.c).
193 ;; It could be used elsewhere, eg Fcall_process_region,
194 ;; server-socket-dir. See bug#7135.
195 (cond ((memq system-type
'(ms-dos windows-nt
))
196 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
198 ((eq system-type
'darwin
)
199 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
201 (let ((tmp (ignore-errors
202 (shell-command-to-string
203 "getconf DARWIN_USER_TEMP_DIR"))))
205 (setq tmp
(replace-regexp-in-string
207 ;; Handles "getconf: Unrecognized variable..."
208 (file-directory-p tmp
)
212 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
214 :initialize custom-initialize-delay
)
216 (use-dialog-box menu boolean
"21.1")
217 (use-file-dialog menu boolean
"22.1")
218 (focus-follows-mouse frames boolean
"20.3")
220 (default-frame-alist frames
221 (repeat (cons :format
"%v"
222 (symbol :tag
"Parameter")
223 (sexp :tag
"Value"))))
224 (mouse-highlight mouse
(choice (const :tag
"disabled" nil
)
225 (const :tag
"always shown" t
)
226 (other :tag
"hidden by keypress" 1))
228 (make-pointer-invisible mouse boolean
"23.2")
229 (menu-bar-mode frames boolean nil
231 ; :initialize custom-initialize-default
232 :set custom-set-minor-mode
)
233 (tool-bar-mode (frames mouse
) boolean nil
234 ; :initialize custom-initialize-default
235 :set custom-set-minor-mode
)
237 (overflow-newline-into-fringe fringe boolean
)
239 (indent-tabs-mode indent boolean
)
241 (meta-prefix-char keyboard character
)
242 (auto-save-interval auto-save integer
)
243 (auto-save-timeout auto-save
(choice (const :tag
"off" nil
)
244 (integer :format
"%v")))
245 (echo-keystrokes minibuffer number
)
246 (polling-period keyboard integer
)
247 (double-click-time mouse
(restricted-sexp
248 :match-alternatives
(integerp 'nil
't
)))
249 (double-click-fuzz mouse integer
"22.1")
250 (inhibit-local-menu-bar-menus menu boolean
)
251 (help-char keyboard character
)
252 (help-event-list keyboard
(repeat (sexp :format
"%v")))
253 (menu-prompting menu boolean
)
254 (select-active-regions killing
255 (choice (const :tag
"always" t
)
256 (const :tag
"only shift-selection or mouse-drag" only
)
257 (const :tag
"off" nil
))
259 (suggest-key-bindings keyboard
(choice (const :tag
"off" nil
)
260 (integer :tag
"time" 2)
262 (debug-on-event debug
263 (choice (const :tag
"None" nil
)
264 (const :tag
"When sent SIGUSR1" sigusr1
)
265 (const :tag
"When sent SIGUSR2" sigusr2
))
268 ;; This is not good news because it will use the wrong
269 ;; version-specific directories when you upgrade. We need
270 ;; customization of the front of the list, maintaining the standard
271 ;; value intact at the back.
272 ;;; (load-path environment
273 ;;; (repeat (choice :tag "[Current dir?]"
274 ;;; :format "%[Current dir?%] %v"
275 ;;; (const :tag " current dir" nil)
276 ;;; (directory :format "%v"))))
278 (enable-recursive-minibuffers minibuffer boolean
)
279 (history-length minibuffer
280 (choice (const :tag
"Infinite" t
) integer
)
282 (history-delete-duplicates minibuffer boolean
"22.1")
283 (read-buffer-completion-ignore-case minibuffer boolean
"23.1")
285 (minibuffer-prompt-properties
289 (const :tag
"Read-Only"
290 :doc
"Prevent prompt from being modified"
294 (const :tag
"Don't Enter"
295 :doc
"Prevent point from ever entering prompt"
298 (point-entered minibuffer-avoid-prompt
)))
300 :tag
"Other Properties"
303 (symbol :tag
"Property")
304 (sexp :tag
"Value"))))
306 (minibuffer-auto-raise minibuffer boolean
)
307 ;; options property set at end
308 (read-buffer-function minibuffer
310 (function-item iswitchb-read-buffer
)
313 (dos-unsupported-char-glyph display integer
)
317 (choice (const :tag
"No modifier" nil
)
318 (const control
) (const meta
)
319 (const alt
) (const hyper
)
320 (const super
)) "23.1")
321 (ns-right-control-modifier
323 (choice (const :tag
"No modifier (work as control)" none
)
324 (const :tag
"Use the value of ns-control-modifier"
326 (const control
) (const meta
)
327 (const alt
) (const hyper
)
328 (const super
)) "24.0")
331 (choice (const :tag
"No modifier" nil
)
332 (const control
) (const meta
)
333 (const alt
) (const hyper
)
334 (const super
)) "23.1")
335 (ns-right-command-modifier
337 (choice (const :tag
"No modifier (work as command)" none
)
338 (const :tag
"Use the value of ns-command-modifier"
340 (const control
) (const meta
)
341 (const alt
) (const hyper
)
342 (const super
)) "24.0")
343 (ns-alternate-modifier
345 (choice (const :tag
"No modifier (work as alternate/option)" none
)
346 (const control
) (const meta
)
347 (const alt
) (const hyper
)
348 (const super
)) "23.1")
349 (ns-right-alternate-modifier
351 (choice (const :tag
"No modifier (work as alternate/option)" none
)
352 (const :tag
"Use the value of ns-alternate-modifier"
354 (const control
) (const meta
)
355 (const alt
) (const hyper
)
356 (const super
)) "23.3")
357 (ns-function-modifier
359 (choice (const :tag
"No modifier (work as function)" none
)
360 (const control
) (const meta
)
361 (const alt
) (const hyper
)
362 (const super
)) "23.1")
363 (ns-antialias-text ns boolean
"23.1")
364 (ns-auto-hide-menu-bar ns boolean
"24.0")
366 (delete-exited-processes processes-basics boolean
)
368 (parse-sexp-ignore-comments editing-basics boolean
)
369 (words-include-escapes editing-basics boolean
)
370 (open-paren-in-column-0-is-defun-start editing-basics boolean
373 (visible-cursor cursor boolean
"22.1")
375 (undo-limit undo integer
)
376 (undo-strong-limit undo integer
)
377 (undo-outer-limit undo
379 (const :tag
"No limit"
383 the undo info for the current command never gets discarded.
384 This should only be chosen under exceptional circumstances,
385 since it could result in memory overflow and make Emacs crash."
389 (temp-buffer-show-function windows
(choice (const nil
) function
))
390 (next-screen-context-lines windows integer
)
391 (scroll-preserve-screen-position
393 (const :tag
"Off (nil)" :value nil
)
394 (const :tag
"Full screen (t)" :value t
)
395 (other :tag
"Always" 1)) "22.1")
398 (const :tag
"Never (nil)" :value nil
)
399 (const :tag
"Only on ttys" :value tty
)
400 (other :tag
"Always" t
)) "23.1")
401 (window-splits windows boolean
"24.1")
402 (window-nest windows boolean
"24.1")
404 (show-trailing-whitespace whitespace-faces boolean nil
406 (scroll-step windows integer
)
407 (scroll-conservatively windows integer
)
408 (scroll-margin windows integer
)
409 (hscroll-margin windows integer
"22.1")
410 (hscroll-step windows number
"22.1")
411 (truncate-partial-width-windows display boolean
"23.1")
412 (mode-line-inverse-video mode-line boolean
)
413 (mode-line-in-non-selected-windows mode-line boolean
"22.1")
414 (line-number-display-limit display
416 (const :tag
"No limit" nil
)))
417 (line-number-display-limit-width display integer
"22.1")
418 (highlight-nonselected-windows display boolean
)
419 (message-log-max debug
(choice (const :tag
"Disable" nil
)
420 (integer :menu-tag
"lines"
422 (other :tag
"Unlimited" t
)))
423 (unibyte-display-via-language-environment mule boolean
)
424 (blink-cursor-alist cursor alist
"22.1")
425 (overline-margin display integer
"22.1")
426 (underline-minimum-offset display integer
"23.1")
427 (mouse-autoselect-window
429 (const :tag
"Off (nil)" :value nil
)
430 (const :tag
"Immediate" :value t
)
431 (number :tag
"Delay by secs" :value
0.5)) "22.1")
434 (const :tag
"Images" :value image
)
435 (const :tag
"Text" :value text
)
436 (const :tag
"Both" :value both
)
437 (const :tag
"Both-horiz" :value both-horiz
)
438 (const :tag
"Text-image-horiz" :value text-image-horiz
)
439 (const :tag
"System default" :value nil
)) "23.3")
440 (tool-bar-max-label-size frames integer
"23.3")
441 (auto-hscroll-mode scrolling boolean
"21.1")
442 (display-hourglass cursor boolean
)
443 (hourglass-delay cursor number
)
446 (scalable-fonts-allowed display boolean
"22.1")
448 (x-bitmap-file-path installation
449 (repeat (directory :format
"%v")))
450 (x-gtk-use-old-file-dialog menu boolean
"22.1")
451 (x-gtk-show-hidden-files menu boolean
"22.1")
452 (x-gtk-file-dialog-help-text menu boolean
"22.1")
453 (x-gtk-whole-detached-tool-bar x boolean
"22.1")
454 (x-gtk-use-system-tooltips tooltip boolean
"23.3")
456 (x-use-underline-position-properties display boolean
"22.1")
457 (x-underline-at-descent-line display boolean
"22.1")
458 (x-stretch-cursor display boolean
"21.1")
460 (font-use-system-font font-selection boolean
"23.2")))
461 this symbol group type standard version native-p rest prop propval
462 ;; This function turns a value
463 ;; into an expression which produces that value.
464 (quoter (lambda (sexp)
465 (if (or (memq sexp
'(t nil
))
468 (memq (car sexp
) '(lambda)))
472 (list 'quote sexp
)))))
481 ;; If we did not specify any standard value expression above,
482 ;; use the current value as the standard value.
483 standard
(if (setq prop
(memq :standard rest
))
485 (if (default-boundp symbol
)
486 (funcall quoter
(default-value symbol
))))
487 ;; Don't complain about missing variables which are
488 ;; irrelevant to this platform.
489 native-p
(save-match-data
491 ((string-match "\\`dos-" (symbol-name symbol
))
492 (eq system-type
'ms-dos
))
493 ((string-match "\\`w32-" (symbol-name symbol
))
494 (eq system-type
'windows-nt
))
495 ((string-match "\\`ns-" (symbol-name symbol
))
497 ((string-match "\\`x-.*gtk" (symbol-name symbol
))
499 ((string-match "\\`x-" (symbol-name symbol
))
500 (fboundp 'x-create-frame
))
501 ((string-match "selection" (symbol-name symbol
))
502 (fboundp 'x-selection-exists-p
))
503 ((string-match "fringe" (symbol-name symbol
))
504 (fboundp 'define-fringe-bitmap
))
505 ((equal "font-use-system-font" (symbol-name symbol
))
506 (featurep 'system-font-setting
))
507 ;; Conditioned on x-create-frame, because that's
508 ;; the condition for loadup.el to preload tool-bar.el.
509 ((string-match "tool-bar-" (symbol-name symbol
))
510 (fboundp 'x-create-frame
))
512 (if (not (boundp symbol
))
513 ;; If variables are removed from C code, give an error here!
515 (message "Note, built-in variable `%S' not bound" symbol
))
516 ;; Save the standard value, unless we already did.
517 (or (get symbol
'standard-value
)
518 (put symbol
'standard-value
(list standard
)))
519 ;; We need these properties independent of whether cus-start is loaded.
520 (if (setq prop
(memq :safe rest
))
521 (put symbol
'safe-local-variable
(cadr prop
)))
522 (if (setq prop
(memq :risky rest
))
523 (put symbol
'risky-local-variable
(cadr prop
)))
524 (if (setq prop
(memq :set rest
))
525 (put symbol
'custom-set
(cadr prop
)))
526 ;; Note this is the _only_ initialize property we handle.
527 (if (eq (cadr (memq :initialize rest
)) 'custom-initialize-delay
)
528 (push symbol custom-delayed-init-variables
))
529 ;; If this is NOT while dumping Emacs, set up the rest of the
530 ;; customization info. This is the stuff that is not needed
531 ;; until someone does M-x customize etc.
533 ;; Add it to the right group(s).
536 (custom-add-to-group g symbol
'custom-variable
))
537 (custom-add-to-group group symbol
'custom-variable
))
539 (put symbol
'custom-type type
)
540 (if version
(put symbol
'custom-version version
))
542 (setq prop
(car rest
)
544 rest
(nthcdr 2 rest
))
545 (cond ((memq prop
'(:standard
:risky
:safe
:set
))) ; handled above
547 (put symbol
'custom-tag propval
))))))))
549 (custom-add-to-group 'iswitchb
'read-buffer-function
'custom-variable
)
550 (custom-add-to-group 'font-lock
'open-paren-in-column-0-is-defun-start
553 ;; Record cus-start as loaded if we have set up all the info that we can.
554 ;; Don't record it as loaded if we have only set up the standard values
555 ;; and safe/risky properties.
557 (provide 'cus-start
))
559 ;;; cus-start.el ends here