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