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