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