* lisp/files.el (automount-dir-prefix): Mark as obsolete.
[emacs.git] / lisp / cus-start.el
blob3863e718f586444c640263a45095a5a3b0b7b9a1
1 ;;; cus-start.el --- define customization properties of builtins
3 ;; Copyright (C) 1997, 1999-2012 Free Software Foundation, Inc.
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Keywords: internal
7 ;; Package: emacs
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/>.
24 ;;; Commentary:
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.
34 ;;; Code:
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
40 ;; of groups)
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 (gc-cons-percentage alloc float)
52 (garbage-collection-messages alloc boolean)
53 ;; buffer.c
54 (mode-line-format mode-line sexp) ;Hard to do right.
55 (major-mode internal function)
56 (case-fold-search matching boolean)
57 (fill-column fill integer)
58 (left-margin fill integer)
59 (tab-width editing-basics integer)
60 (ctl-arrow display boolean)
61 (truncate-lines display boolean)
62 (word-wrap display boolean)
63 (selective-display-ellipses display boolean)
64 (indicate-empty-lines fringe boolean)
65 (indicate-buffer-boundaries
66 fringe
67 (choice
68 (const :tag "No indicators" nil)
69 (const :tag "On left, with arrows" left)
70 (const :tag "On right, with arrows" right)
71 (set :tag "Pick your own design"
72 :value ((t . nil))
73 :format "%{%t%}:\n%v\n%d"
74 :doc "You can specify a default and then override it \
75 for individual indicators.
76 Leaving \"Default\" unchecked is equivalent with specifying a default of
77 \"Do not show\"."
78 (choice :tag "Default"
79 :value (t . nil)
80 (const :tag "Do not show" (t . nil))
81 (const :tag "On the left" (t . left))
82 (const :tag "On the right" (t . right)))
83 (choice :tag "Top"
84 :value (top . left)
85 (const :tag "Do not show" (top . nil))
86 (const :tag "On the left" (top . left))
87 (const :tag "On the right" (top . right)))
88 (choice :tag "Bottom"
89 :value (bottom . left)
90 (const :tag "Do not show" (bottom . nil))
91 (const :tag "On the left" (bottom . left))
92 (const :tag "On the right" (bottom . right)))
93 (choice :tag "Up arrow"
94 :value (up . left)
95 (const :tag "Do not show" (up . nil))
96 (const :tag "On the left" (up . left))
97 (const :tag "On the right" (up . right)))
98 (choice :tag "Down arrow"
99 :value (down . left)
100 (const :tag "Do not show" (down . nil))
101 (const :tag "On the left" (down . left))
102 (const :tag "On the right" (down . right))))
103 (other :tag "On left, no arrows" t)))
104 (scroll-up-aggressively windows
105 (choice (const :tag "off" nil) number)
106 "21.1")
107 (scroll-down-aggressively windows
108 (choice (const :tag "off" nil) number)
109 "21.1")
110 (line-spacing display (choice (const :tag "none" nil) integer)
111 "22.1")
112 (cursor-in-non-selected-windows
113 cursor boolean nil
114 :tag "Cursor In Non-selected Windows"
115 :set (lambda (symbol value)
116 (set-default symbol value)
117 (force-mode-line-update t)))
118 (transient-mark-mode editing-basics boolean nil
119 :standard (not noninteractive)
120 :initialize custom-initialize-delay
121 :set custom-set-minor-mode)
122 (bidi-paragraph-direction
123 paragraphs
124 (choice
125 (const :tag "Left to Right" left-to-right)
126 (const :tag "Right to Left" right-to-left)
127 (const :tag "Dynamic, according to paragraph text" nil))
128 "24.1")
129 ;; callint.c
130 (mark-even-if-inactive editing-basics boolean)
131 ;; callproc.c
132 (shell-file-name execute file)
133 (exec-path execute
134 (repeat (choice (const :tag "default directory" nil)
135 (directory :format "%v"))))
136 (exec-suffixes execute (repeat string))
137 ;; charset.c
138 (charset-map-path installation
139 (repeat (directory :format "%v")))
140 ;; coding.c
141 (inhibit-eol-conversion mule boolean)
142 (eol-mnemonic-undecided mule string)
143 ;; startup.el fiddles with the values. IMO, would be
144 ;; simpler to just use #ifdefs in coding.c.
145 (eol-mnemonic-unix mule string nil
146 :standard
147 (if (memq system-type '(ms-dos windows-nt))
148 "(Unix)" ":"))
149 (eol-mnemonic-dos mule string nil
150 :standard
151 (if (memq system-type '(ms-dos windows-nt))
152 "\\" "(DOS)"))
153 (eol-mnemonic-mac mule string nil
154 :standard "(Mac)")
155 (file-coding-system-alist
156 mule
157 (alist
158 :key-type (regexp :tag "File regexp")
159 :value-type (choice
160 :value (undecided . undecided)
161 (cons :tag "Encoding/decoding pair"
162 :value (undecided . undecided)
163 (coding-system :tag "Decoding")
164 (coding-system :tag "Encoding"))
165 (coding-system
166 :tag "Single coding system"
167 :value undecided
168 :match (lambda (widget value)
169 (and value (not (functionp value)))))
170 (function :value ignore))))
171 ;; dired.c
172 (completion-ignored-extensions dired
173 (repeat (string :format "%v")))
174 ;; dispnew.c
175 (baud-rate display integer)
176 (inverse-video display boolean)
177 (visible-bell display boolean)
178 (no-redraw-on-reenter display boolean)
180 ;; dosfns.c
181 (dos-display-scancodes display boolean)
182 (dos-hyper-key keyboard integer)
183 (dos-super-key keyboard integer)
184 (dos-keypad-mode keyboard integer)
186 ;; editfns.c
187 (user-full-name mail string)
188 ;; eval.c
189 (max-specpdl-size limits integer)
190 (max-lisp-eval-depth limits integer)
191 (max-mini-window-height limits
192 (choice (const :tag "quarter screen" nil)
193 number) "23.1")
194 (debug-on-error debug
195 (choice (const :tag "off")
196 (repeat :menu-tag "When"
197 :value (nil)
198 (symbol :format "%v"))
199 (const :tag "always" t)))
200 (debug-ignored-errors debug (repeat (choice symbol regexp)))
201 (debug-on-quit debug boolean)
202 (debug-on-signal debug boolean)
203 ;; fileio.c
204 (delete-by-moving-to-trash auto-save boolean "23.1")
205 (auto-save-visited-file-name auto-save boolean)
206 ;; filelock.c
207 (temporary-file-directory
208 ;; Darwin section added 24.1, does not seem worth :version bump.
209 files directory nil
210 :standard
211 (file-name-as-directory
212 ;; FIXME ? Should there be Ftemporary_file_directory to do this
213 ;; more robustly (cf set_local_socket in emacsclient.c).
214 ;; It could be used elsewhere, eg Fcall_process_region,
215 ;; server-socket-dir. See bug#7135.
216 (cond ((memq system-type '(ms-dos windows-nt))
217 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP")
218 "c:/temp"))
219 ((eq system-type 'darwin)
220 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
221 ;; See bug#7135.
222 (let ((tmp (ignore-errors
223 (shell-command-to-string
224 "getconf DARWIN_USER_TEMP_DIR"))))
225 (and (stringp tmp)
226 (setq tmp (replace-regexp-in-string
227 "\n\\'" "" tmp))
228 ;; Handles "getconf: Unrecognized variable..."
229 (file-directory-p tmp)
230 tmp))
231 "/tmp"))
233 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
234 "/tmp"))))
235 :initialize custom-initialize-delay)
236 ;; fns.c
237 (use-dialog-box menu boolean "21.1")
238 (use-file-dialog menu boolean "22.1")
239 (focus-follows-mouse frames boolean "20.3")
240 ;; fontset.c
241 (vertical-centering-font-regexp display regexp)
242 ;; frame.c
243 (default-frame-alist frames
244 (repeat (cons :format "%v"
245 (symbol :tag "Parameter")
246 (sexp :tag "Value"))))
247 (mouse-highlight mouse (choice (const :tag "disabled" nil)
248 (const :tag "always shown" t)
249 (other :tag "hidden by keypress" 1))
250 "22.1")
251 (make-pointer-invisible mouse boolean "23.2")
252 (menu-bar-mode frames boolean nil
253 ;; FIXME?
254 ; :initialize custom-initialize-default
255 :set custom-set-minor-mode)
256 (tool-bar-mode (frames mouse) boolean nil
257 ; :initialize custom-initialize-default
258 :set custom-set-minor-mode)
259 ;; fringe.c
260 (overflow-newline-into-fringe fringe boolean)
261 ;; image.c
262 (imagemagick-render-type image integer "24.1")
263 ;; indent.c
264 (indent-tabs-mode indent boolean)
265 ;; keyboard.c
266 (meta-prefix-char keyboard character)
267 (auto-save-interval auto-save integer)
268 (auto-save-timeout auto-save (choice (const :tag "off" nil)
269 (integer :format "%v")))
270 (echo-keystrokes minibuffer number)
271 (polling-period keyboard integer)
272 (double-click-time mouse (restricted-sexp
273 :match-alternatives (integerp 'nil 't)))
274 (double-click-fuzz mouse integer "22.1")
275 (inhibit-local-menu-bar-menus menu boolean)
276 (help-char keyboard character)
277 (help-event-list keyboard (repeat (sexp :format "%v")))
278 (menu-prompting menu boolean)
279 (select-active-regions killing
280 (choice (const :tag "always" t)
281 (const :tag "only shift-selection or mouse-drag" only)
282 (const :tag "off" nil))
283 "24.1")
284 (debug-on-event debug
285 (choice (const :tag "None" nil)
286 (const :tag "When sent SIGUSR1" sigusr1)
287 (const :tag "When sent SIGUSR2" sigusr2))
288 "24.1")
290 ;; This is not good news because it will use the wrong
291 ;; version-specific directories when you upgrade. We need
292 ;; customization of the front of the list, maintaining the standard
293 ;; value intact at the back.
294 ;;; (load-path environment
295 ;;; (repeat (choice :tag "[Current dir?]"
296 ;;; :format "%[Current dir?%] %v"
297 ;;; (const :tag " current dir" nil)
298 ;;; (directory :format "%v"))))
299 ;; minibuf.c
300 (enable-recursive-minibuffers minibuffer boolean)
301 (history-length minibuffer
302 (choice (const :tag "Infinite" t) integer)
303 "22.1")
304 (history-delete-duplicates minibuffer boolean "22.1")
305 (read-buffer-completion-ignore-case minibuffer boolean "23.1")
307 (minibuffer-prompt-properties
308 minibuffer
309 (list
310 (checklist :inline t
311 (const :tag "Read-Only"
312 :doc "Prevent prompt from being modified"
313 :format "%t%n%h"
314 :inline t
315 (read-only t))
316 (const :tag "Don't Enter"
317 :doc "Prevent point from ever entering prompt"
318 :format "%t%n%h"
319 :inline t
320 (point-entered minibuffer-avoid-prompt)))
321 (repeat :inline t
322 :tag "Other Properties"
323 (list :inline t
324 :format "%v"
325 (symbol :tag "Property")
326 (sexp :tag "Value"))))
327 "21.1")
328 (minibuffer-auto-raise minibuffer boolean)
329 ;; options property set at end
330 (read-buffer-function minibuffer
331 (choice (const nil)
332 (function-item iswitchb-read-buffer)
333 function))
334 ;; msdos.c
335 (dos-unsupported-char-glyph display integer)
336 ;; nsterm.m
337 (ns-control-modifier
339 (choice (const :tag "No modifier" nil)
340 (const control) (const meta)
341 (const alt) (const hyper)
342 (const super)) "23.1")
343 (ns-right-control-modifier
345 (choice (const :tag "No modifier (work as control)" none)
346 (const :tag "Use the value of ns-control-modifier"
347 left)
348 (const control) (const meta)
349 (const alt) (const hyper)
350 (const super)) "24.0")
351 (ns-command-modifier
353 (choice (const :tag "No modifier" nil)
354 (const control) (const meta)
355 (const alt) (const hyper)
356 (const super)) "23.1")
357 (ns-right-command-modifier
359 (choice (const :tag "No modifier (work as command)" none)
360 (const :tag "Use the value of ns-command-modifier"
361 left)
362 (const control) (const meta)
363 (const alt) (const hyper)
364 (const super)) "24.0")
365 (ns-alternate-modifier
367 (choice (const :tag "No modifier (work as alternate/option)" none)
368 (const control) (const meta)
369 (const alt) (const hyper)
370 (const super)) "23.1")
371 (ns-right-alternate-modifier
373 (choice (const :tag "No modifier (work as alternate/option)" none)
374 (const :tag "Use the value of ns-alternate-modifier"
375 left)
376 (const control) (const meta)
377 (const alt) (const hyper)
378 (const super)) "23.3")
379 (ns-function-modifier
381 (choice (const :tag "No modifier (work as function)" none)
382 (const control) (const meta)
383 (const alt) (const hyper)
384 (const super)) "23.1")
385 (ns-antialias-text ns boolean "23.1")
386 (ns-auto-hide-menu-bar ns boolean "24.0")
387 ;; process.c
388 (delete-exited-processes processes-basics boolean)
389 ;; syntax.c
390 (parse-sexp-ignore-comments editing-basics boolean)
391 (words-include-escapes editing-basics boolean)
392 (open-paren-in-column-0-is-defun-start editing-basics boolean
393 "21.1")
394 ;; term.c
395 (visible-cursor cursor boolean "22.1")
396 ;; undo.c
397 (undo-limit undo integer)
398 (undo-strong-limit undo integer)
399 (undo-outer-limit undo
400 (choice integer
401 (const :tag "No limit"
402 :format "%t\n%d"
403 :doc
404 "With this choice, \
405 the undo info for the current command never gets discarded.
406 This should only be chosen under exceptional circumstances,
407 since it could result in memory overflow and make Emacs crash."
408 nil))
409 "22.1")
410 ;; window.c
411 (temp-buffer-show-function windows (choice (const nil) function))
412 (next-screen-context-lines windows integer)
413 (scroll-preserve-screen-position
414 windows (choice
415 (const :tag "Off (nil)" :value nil)
416 (const :tag "Full screen (t)" :value t)
417 (other :tag "Always" 1)) "22.1")
418 (recenter-redisplay
419 windows (choice
420 (const :tag "Never (nil)" :value nil)
421 (const :tag "Only on ttys" :value tty)
422 (other :tag "Always" t)) "23.1")
423 (window-combination-resize windows boolean "24.1")
424 (window-combination-limit windows boolean "24.1")
425 ;; xdisp.c
426 (show-trailing-whitespace whitespace-faces boolean nil
427 :safe booleanp)
428 (scroll-step windows integer)
429 (scroll-conservatively windows integer)
430 (scroll-margin windows integer)
431 (hscroll-margin windows integer "22.1")
432 (hscroll-step windows number "22.1")
433 (truncate-partial-width-windows display boolean "23.1")
434 (make-cursor-line-fully-visible windows boolean)
435 (mode-line-inverse-video mode-line boolean)
436 (mode-line-in-non-selected-windows mode-line boolean "22.1")
437 (line-number-display-limit display
438 (choice integer
439 (const :tag "No limit" nil)))
440 (line-number-display-limit-width display integer "22.1")
441 (highlight-nonselected-windows display boolean)
442 (message-log-max debug (choice (const :tag "Disable" nil)
443 (integer :menu-tag "lines"
444 :format "%v")
445 (other :tag "Unlimited" t)))
446 (unibyte-display-via-language-environment mule boolean)
447 (blink-cursor-alist cursor alist "22.1")
448 (overline-margin display integer "22.1")
449 (underline-minimum-offset display integer "23.1")
450 (mouse-autoselect-window
451 display (choice
452 (const :tag "Off (nil)" :value nil)
453 (const :tag "Immediate" :value t)
454 (number :tag "Delay by secs" :value 0.5)) "22.1")
455 (tool-bar-style
456 frames (choice
457 (const :tag "Images" :value image)
458 (const :tag "Text" :value text)
459 (const :tag "Both" :value both)
460 (const :tag "Both-horiz" :value both-horiz)
461 (const :tag "Text-image-horiz" :value text-image-horiz)
462 (const :tag "System default" :value nil)) "23.3")
463 (tool-bar-max-label-size frames integer "23.3")
464 (auto-hscroll-mode scrolling boolean "21.1")
465 (void-text-area-pointer cursor
466 (choice
467 (const :tag "Standard (text pointer)" :value nil)
468 (const :tag "Arrow" :value arrow)
469 (const :tag "Text pointer" :value text)
470 (const :tag "Hand" :value hand)
471 (const :tag "Vertical dragger" :value vdrag)
472 (const :tag "Horizontal dragger" :value hdrag)
473 (const :tag "Same as mode line" :value modeline)
474 (const :tag "Hourglass" :value hourglass)))
475 (display-hourglass cursor boolean)
476 (hourglass-delay cursor number)
478 ;; xfaces.c
479 (font-list-limit display integer)
480 (scalable-fonts-allowed display boolean "22.1")
481 ;; xfns.c
482 (x-bitmap-file-path installation
483 (repeat (directory :format "%v")))
484 (x-gtk-use-old-file-dialog menu boolean "22.1")
485 (x-gtk-show-hidden-files menu boolean "22.1")
486 (x-gtk-file-dialog-help-text menu boolean "22.1")
487 (x-gtk-whole-detached-tool-bar x boolean "22.1")
488 (x-gtk-use-system-tooltips tooltip boolean "23.3")
489 ;; xterm.c
490 (x-use-underline-position-properties display boolean "22.1")
491 (x-underline-at-descent-line display boolean "22.1")
492 (x-stretch-cursor display boolean "21.1")
493 ;; xselect.c
494 (x-select-enable-clipboard-manager killing boolean "24.1")
495 ;; xsettings.c
496 (font-use-system-font font-selection boolean "23.2")))
497 this symbol group type standard version native-p rest prop propval
498 ;; This function turns a value
499 ;; into an expression which produces that value.
500 (quoter (lambda (sexp)
501 (if (or (memq sexp '(t nil))
502 (keywordp sexp)
503 (and (listp sexp)
504 (memq (car sexp) '(lambda)))
505 (stringp sexp)
506 (numberp sexp))
507 sexp
508 (list 'quote sexp)))))
509 (while all
510 (setq this (car all)
511 all (cdr all)
512 symbol (nth 0 this)
513 group (nth 1 this)
514 type (nth 2 this)
515 version (nth 3 this)
516 rest (nthcdr 4 this)
517 ;; If we did not specify any standard value expression above,
518 ;; use the current value as the standard value.
519 standard (if (setq prop (memq :standard rest))
520 (cadr prop)
521 (if (default-boundp symbol)
522 (funcall quoter (default-value symbol))))
523 ;; Don't complain about missing variables which are
524 ;; irrelevant to this platform.
525 native-p (save-match-data
526 (cond
527 ((string-match "\\`dos-" (symbol-name symbol))
528 (eq system-type 'ms-dos))
529 ((string-match "\\`w32-" (symbol-name symbol))
530 (eq system-type 'windows-nt))
531 ((string-match "\\`ns-" (symbol-name symbol))
532 (featurep 'ns))
533 ((string-match "\\`x-.*gtk" (symbol-name symbol))
534 (featurep 'gtk))
535 ((string-match "clipboard-manager" (symbol-name symbol))
536 (boundp 'x-select-enable-clipboard-manager))
537 ((string-match "\\`x-" (symbol-name symbol))
538 (fboundp 'x-create-frame))
539 ((string-match "selection" (symbol-name symbol))
540 (fboundp 'x-selection-exists-p))
541 ((string-match "fringe" (symbol-name symbol))
542 (fboundp 'define-fringe-bitmap))
543 ((string-match "\\`imagemagick" (symbol-name symbol))
544 (fboundp 'imagemagick-types))
545 ((equal "font-use-system-font" (symbol-name symbol))
546 (featurep 'system-font-setting))
547 ;; Conditioned on x-create-frame, because that's
548 ;; the condition for loadup.el to preload tool-bar.el.
549 ((string-match "tool-bar-" (symbol-name symbol))
550 (fboundp 'x-create-frame))
551 (t t))))
552 (if (not (boundp symbol))
553 ;; If variables are removed from C code, give an error here!
554 (and native-p
555 (message "Note, built-in variable `%S' not bound" symbol))
556 ;; Save the standard value, unless we already did.
557 (or (get symbol 'standard-value)
558 (put symbol 'standard-value (list standard)))
559 ;; We need these properties independent of whether cus-start is loaded.
560 (if (setq prop (memq :safe rest))
561 (put symbol 'safe-local-variable (cadr prop)))
562 (if (setq prop (memq :risky rest))
563 (put symbol 'risky-local-variable (cadr prop)))
564 (if (setq prop (memq :set rest))
565 (put symbol 'custom-set (cadr prop)))
566 ;; Note this is the _only_ initialize property we handle.
567 (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay)
568 (push symbol custom-delayed-init-variables))
569 ;; If this is NOT while dumping Emacs, set up the rest of the
570 ;; customization info. This is the stuff that is not needed
571 ;; until someone does M-x customize etc.
572 (unless purify-flag
573 ;; Add it to the right group(s).
574 (if (listp group)
575 (dolist (g group)
576 (custom-add-to-group g symbol 'custom-variable))
577 (custom-add-to-group group symbol 'custom-variable))
578 ;; Set the type.
579 (put symbol 'custom-type type)
580 (if version (put symbol 'custom-version version))
581 (while rest
582 (setq prop (car rest)
583 propval (cadr rest)
584 rest (nthcdr 2 rest))
585 (cond ((memq prop '(:standard :risky :safe :set))) ; handled above
586 ((eq prop :tag)
587 (put symbol 'custom-tag propval))))))))
589 (custom-add-to-group 'iswitchb 'read-buffer-function 'custom-variable)
590 (custom-add-to-group 'font-lock 'open-paren-in-column-0-is-defun-start
591 'custom-variable)
593 ;; Record cus-start as loaded if we have set up all the info that we can.
594 ;; Don't record it as loaded if we have only set up the standard values
595 ;; and safe/risky properties.
596 (unless purify-flag
597 (provide 'cus-start))
599 ;;; cus-start.el ends here