ERC: Sync version 5.3, release candidate 1.
[bpt/emacs.git] / lisp / cus-start.el
CommitLineData
1cd7adc6 1;;; cus-start.el --- define customization properties of builtins
1444b0c0 2;;
0d30b337 3;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
409cc4a3 4;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
1444b0c0
PA
5;;
6;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
7;; Keywords: internal
8
c2383d2d
RS
9;; This file is part of GNU Emacs.
10
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
b4aa6026 13;; the Free Software Foundation; either version 3, or (at your option)
c2383d2d
RS
14;; any later version.
15
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.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
086add15
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
c2383d2d 25
1444b0c0
PA
26;;; Commentary:
27;;
4883633e 28;; This file adds customize support for built-in variables.
1444b0c0 29
4883633e
RS
30;; While dumping Emacs, this file is loaded, but it only records
31;; the standard values; it does not do the rest of the job.
32;; Later on, if the user makes a customization buffer,
33;; this file is loaded again with (require 'cus-start);
34;; then it does the whole job.
1444b0c0 35
4883633e 36;;; Code:
1444b0c0 37
e047f448 38(let ((all '(;; alloc.c
1444b0c0 39 (gc-cons-threshold alloc integer)
0f014aa1 40 (garbage-collection-messages alloc boolean)
1444b0c0 41 ;; buffer.c
e45db0fb 42 (mode-line-format mode-line sexp) ;Hard to do right.
1444b0c0 43 (default-major-mode internal function)
924ef223 44 (enable-multibyte-characters mule boolean)
1444b0c0
PA
45 (case-fold-search matching boolean)
46 (fill-column fill integer)
47 (left-margin fill integer)
48 (tab-width editing-basics integer)
49 (ctl-arrow display boolean)
50 (truncate-lines display boolean)
1444b0c0 51 (selective-display-ellipses display boolean)
516b77a3 52 (indicate-empty-lines fringe boolean)
eb94dac6
LT
53 (indicate-buffer-boundaries
54 fringe
55 (choice
56 (const :tag "No indicators" nil)
57 (const :tag "On left, with arrows" left)
58 (const :tag "On right, with arrows" right)
a4fbb790
LT
59 (set :tag "Pick your own design"
60 :value ((t . nil))
61 :format "%{%t%}:\n%v\n%d"
62 :doc "You can specify a default and then override it \
63for individual indicators.
64Leaving \"Default\" unchecked is equivalent with specifying a default of
65\"Do not show\"."
66 (choice :tag "Default"
67 :value (t . nil)
68 (const :tag "Do not show" (t . nil))
69 (const :tag "On the left" (t . left))
70 (const :tag "On the right" (t . right)))
71 (choice :tag "Top"
72 :value (top . left)
73 (const :tag "Do not show" (top . nil))
74 (const :tag "On the left" (top . left))
75 (const :tag "On the right" (top . right)))
76 (choice :tag "Bottom"
77 :value (bottom . left)
78 (const :tag "Do not show" (bottom . nil))
79 (const :tag "On the left" (bottom . left))
80 (const :tag "On the right" (bottom . right)))
81 (choice :tag "Up arrow"
82 :value (up . left)
83 (const :tag "Do not show" (up . nil))
84 (const :tag "On the left" (up . left))
85 (const :tag "On the right" (up . right)))
86 (choice :tag "Down arrow"
87 :value (down . left)
88 (const :tag "Do not show" (down . nil))
89 (const :tag "On the left" (down . left))
90 (const :tag "On the right" (down . right))))
516b77a3 91 (other :tag "On left, no arrows" t)))
c6d57325
RS
92 (scroll-up-aggressively windows
93 (choice (const :tag "off" nil) number)
94 "21.1")
95 (scroll-down-aggressively windows
96 (choice (const :tag "off" nil) number)
97 "21.1")
6671cab3
MR
98 (line-spacing display (choice (const :tag "none" nil) integer)
99 "22.1")
1444b0c0
PA
100 ;; callint.c
101 (mark-even-if-inactive editing-basics boolean)
102 ;; callproc.c
103 (shell-file-name execute file)
104 (exec-path execute
f747a488 105 (repeat (choice (const :tag "default directory" nil)
72e869ba 106 (directory :format "%v"))))
5fc9eb7c
DL
107 ;; coding.c
108 (inhibit-eol-conversion mule boolean)
de0d1fc5
EZ
109 (eol-mnemonic-undecided mule string)
110 (eol-mnemonic-unix mule string)
111 (eol-mnemonic-dos mule string)
112 (eol-mnemonic-mac mule string)
13eb63ff
DL
113 (file-coding-system-alist
114 mule
115 (alist
116 :key-type (regexp :tag "File regexp")
117 :value-type (choice
118 :value (undecided . undecided)
119 (cons :tag "Encoding/decoding pair"
120 :value (undecided . undecided)
121 (coding-system :tag "Decoding")
122 (coding-system :tag "Encoding"))
70c2811c
KY
123 (coding-system
124 :tag "Single coding system"
125 :value undecided
126 :match (lambda (widget value)
127 (and value (not (functionp value)))))
13eb63ff 128 (function :value ignore))))
6671cab3 129 (selection-coding-system mule coding-system "22.1")
1444b0c0 130 ;; dired.c
71296446 131 (completion-ignored-extensions dired
1444b0c0 132 (repeat (string :format "%v")))
0849a37e 133 ;; dispnew.c
1444b0c0
PA
134 (baud-rate display integer)
135 (inverse-video display boolean)
136 (visible-bell display boolean)
137 (no-redraw-on-reenter display boolean)
138 ;; editfns.c
139 (user-full-name mail string)
140 ;; eval.c
141 (max-specpdl-size limits integer)
142 (max-lisp-eval-depth limits integer)
f8add097
RS
143 (max-mini-window-height limits
144 (choice (const :tag "quarter screen" nil)
6671cab3 145 number) "23.1")
1444b0c0
PA
146 (stack-trace-on-error debug
147 (choice (const :tag "off")
148 (repeat :menu-tag "When"
149 :value (nil)
150 (symbol :format "%v"))
151 (const :tag "always" t)))
71296446 152 (debug-on-error debug
1444b0c0
PA
153 (choice (const :tag "off")
154 (repeat :menu-tag "When"
155 :value (nil)
156 (symbol :format "%v"))
157 (const :tag "always" t)))
158 (debug-ignored-errors debug (repeat (choice symbol regexp)))
507c9247
RS
159 (debug-on-quit debug
160 (choice (const :tag "off")
161 (repeat :menu-tag "When"
162 :value (nil)
163 (symbol :format "%v"))
164 (const :tag "always" t)))
1444b0c0
PA
165 ;; fileio.c
166 (insert-default-directory minibuffer boolean)
bf247b6e 167 (read-file-name-completion-ignore-case minibuffer boolean "22.1")
78976e0a 168 ;; fns.c
37328bcd 169 (use-dialog-box menu boolean "21.1")
bf247b6e 170 (use-file-dialog menu boolean "22.1")
f4c307a5 171 (focus-follows-mouse frames boolean "20.3")
1444b0c0
PA
172 ;; frame.c
173 (default-frame-alist frames
174 (repeat (cons :format "%v"
175 (symbol :tag "Parameter")
176 (sexp :tag "Value"))))
140fb7ff
KS
177 (mouse-highlight mouse (choice (const :tag "disabled" nil)
178 (const :tag "always shown" t)
6671cab3
MR
179 (other :tag "hidden by keypress" 1))
180 "22.1")
48d707c5 181 ;; fringe.c
516b77a3 182 (overflow-newline-into-fringe fringe boolean)
1444b0c0 183 ;; indent.c
01892a52 184 (indent-tabs-mode indent boolean)
1444b0c0
PA
185 ;; keyboard.c
186 (meta-prefix-char keyboard character)
187 (auto-save-interval auto-save integer)
188 (auto-save-timeout auto-save (choice (const :tag "off" nil)
189 (integer :format "%v")))
ac1b1728 190 (echo-keystrokes minibuffer number)
1444b0c0 191 (polling-period keyboard integer)
4db2b1c7
RS
192 (double-click-time mouse (restricted-sexp
193 :match-alternatives (integerp 'nil 't)))
6671cab3 194 (double-click-fuzz mouse integer "22.1")
1444b0c0
PA
195 (inhibit-local-menu-bar-menus menu boolean)
196 (help-char keyboard character)
197 (help-event-list keyboard (repeat (sexp :format "%v")))
198 (menu-prompting menu boolean)
1444b0c0
PA
199 (suggest-key-bindings keyboard (choice (const :tag "off" nil)
200 (integer :tag "time" 2)
79221864 201 (other :tag "on")))
2f566b18
YM
202 ;; macselect.c
203 (mac-dnd-known-types mac (repeat string) "22.1")
814b36fe
YM
204 ;; macterm.c
205 (mac-control-modifier mac (choice (const :tag "No modifier" nil)
206 (const control) (const meta)
207 (const alt) (const hyper)
208 (const super)) "22.1")
209 (mac-command-modifier mac (choice (const :tag "No modifier" nil)
210 (const control) (const meta)
211 (const alt) (const hyper)
212 (const super)) "22.1")
213 (mac-option-modifier mac (choice (const :tag "No modifier (work as option)" nil)
214 (const control) (const meta)
215 (const alt) (const hyper)
216 (const super)) "22.1")
217 (mac-function-modifier mac
218 (choice (const :tag "No modifier (work as function)" nil)
219 (const control) (const meta)
220 (const alt) (const hyper)
221 (const super)) "22.1")
222 (mac-emulate-three-button-mouse mac
223 (choice (const :tag "No emulation" nil)
224 (const :tag "Option->2, Command->3" t)
225 (const :tag "Command->2, Option->3" reverse))
226 "22.1")
227 (mac-wheel-button-is-mouse-2 mac boolean "22.1")
228 (mac-pass-command-to-system mac boolean "22.1")
229 (mac-pass-control-to-system mac boolean "22.1")
230 (mac-allow-anti-aliasing mac boolean "22.1")
2d4a5c50
YM
231 (mac-ts-script-language-on-focus mac
232 (choice (const :tag "System default behavior" nil)
233 (const :tag "Restore to script/language used in the last focus frame" t)
234 (cons :tag "Specify script/language"
235 (integer :tag "Script code")
236 (integer :tag "Language code")))
237 "22.1")
5f537e54 238
37328bcd
DL
239;; This is not good news because it will use the wrong
240;; version-specific directories when you upgrade. We need
241;; customization of the front of the list, maintaining the standard
242;; value intact at the back.
71296446 243;;; (load-path environment
37328bcd
DL
244;;; (repeat (choice :tag "[Current dir?]"
245;;; :format "%[Current dir?%] %v"
246;;; (const :tag " current dir" nil)
247;;; (directory :format "%v"))))
1444b0c0
PA
248 ;; minibuf.c
249 (completion-auto-help minibuffer boolean)
250 (enable-recursive-minibuffers minibuffer boolean)
408f56b2 251 (history-length minibuffer
6671cab3
MR
252 (choice (const :tag "Infinite" t) integer)
253 "22.1")
254 (history-delete-duplicates minibuffer boolean "22.1")
8f62f2b8
MB
255 (minibuffer-prompt-properties
256 minibuffer
257 (list
258 (checklist :inline t
259 (const :tag "Read-Only"
260 :doc "Prevent prompt from being modified"
261 :format "%t%n%h"
262 :inline t
263 (read-only t))
c9133fa6 264 (const :tag "Don't Enter"
8f62f2b8
MB
265 :doc "Prevent point from ever entering prompt"
266 :format "%t%n%h"
267 :inline t
268 (point-entered minibuffer-avoid-prompt)))
269 (repeat :inline t
270 :tag "Other Properties"
271 (list :inline t
272 :format "%v"
273 (symbol :tag "Property")
ecf5279a
DL
274 (sexp :tag "Value"))))
275 "21.1")
1444b0c0 276 (minibuffer-auto-raise minibuffer boolean)
ecf5279a 277 ;; options property set at end
a8a1b05d
DL
278 (read-buffer-function minibuffer
279 (choice (const nil)
280 (function-item iswitchb-read-buffer)
281 function))
b78fba02
EZ
282 ;; msdos.c
283 (dos-unsupported-char-glyph display integer)
1444b0c0 284 ;; process.c
4883633e 285 (delete-exited-processes processes-basics boolean)
1444b0c0
PA
286 ;; syntax.c
287 (parse-sexp-ignore-comments editing-basics boolean)
288 (words-include-escapes editing-basics boolean)
779d0b80
DL
289 (open-paren-in-column-0-is-defun-start editing-basics boolean
290 "21.1")
98e071b5
SM
291 ;; term.c
292 (visible-cursor cursor boolean "22.1")
0f08b956
LT
293 ;; undo.c
294 (undo-limit undo integer)
295 (undo-strong-limit undo integer)
296 (undo-outer-limit undo
297 (choice integer
298 (const :tag "No limit"
299 :format "%t\n%d"
300 :doc
301 "With this choice, \
302the undo info for the current command never gets discarded.
303This should only be chosen under exceptional circumstances,
304since it could result in memory overflow and make Emacs crash."
305 nil))
306 "22.1")
1444b0c0 307 ;; window.c
4cb464b7
DL
308 (temp-buffer-show-function windows (choice (const nil) function))
309 (display-buffer-function windows (choice (const nil) function))
1444b0c0
PA
310 (pop-up-frames frames boolean)
311 (pop-up-frame-function frames function)
71296446
JB
312 (special-display-buffer-names
313 frames
1444b0c0
PA
314 (repeat (choice :tag "Buffer"
315 :value ""
316 (string :format "%v")
317 (cons :tag "With attributes"
318 :format "%v"
319 :value ("" . nil)
320 (string :format "%v")
321 (repeat :tag "Attributes"
322 (cons :format "%v"
323 (symbol :tag "Parameter")
324 (sexp :tag "Value")))))))
325 (special-display-regexps
71296446 326 frames
1444b0c0
PA
327 (repeat (choice :tag "Buffer"
328 :value ""
329 (regexp :format "%v")
330 (cons :tag "With attributes"
331 :format "%v"
332 :value ("" . nil)
333 (regexp :format "%v")
334 (repeat :tag "Attributes"
335 (cons :format "%v"
336 (symbol :tag "Parameter")
337 (sexp :tag "Value")))))))
338 (special-display-function frames function)
339 (same-window-buffer-names windows (repeat (string :format "%v")))
340 (same-window-regexps windows (repeat (regexp :format "%v")))
341 (pop-up-windows windows boolean)
d2946490 342 (even-window-heights windows boolean)
74f54b54 343 (next-screen-context-lines windows integer)
1444b0c0 344 (split-height-threshold windows integer)
c8f1ea76
SM
345 (split-window-preferred-function
346 windows
347 (choice (const :tag "vertically" split-window)
348 ;; FIXME: Add `sensibly' which chooses between
349 ;; vertical or horizontal splits depending on the size
350 ;; and shape of the window.
351 (const :tag "horizontally"
352 (lambda (window)
6671cab3
MR
353 (split-window window nil 'horiz))))
354 "23.1")
1444b0c0
PA
355 (window-min-height windows integer)
356 (window-min-width windows integer)
7704b6b1
KS
357 (scroll-preserve-screen-position
358 windows (choice
359 (const :tag "Off (nil)" :value nil)
360 (const :tag "Full screen (t)" :value t)
6671cab3 361 (other :tag "Always" 1)) "22.1")
13eb63ff 362 (display-buffer-reuse-frames windows boolean "21.1")
1444b0c0
PA
363 ;; xdisp.c
364 (scroll-step windows integer)
ccbb360e
RS
365 (scroll-conservatively windows integer)
366 (scroll-margin windows integer)
4e371ce8
EZ
367 (hscroll-margin windows integer "22.1")
368 (hscroll-step windows number "22.1")
1444b0c0 369 (truncate-partial-width-windows display boolean)
e45db0fb
MR
370 (mode-line-inverse-video mode-line boolean)
371 (mode-line-in-non-selected-windows mode-line boolean "22.1")
37328bcd
DL
372 (line-number-display-limit display
373 (choice integer
374 (const :tag "No limit" nil)))
6671cab3 375 (line-number-display-limit-width display integer "22.1")
1444b0c0
PA
376 (highlight-nonselected-windows display boolean)
377 (message-log-max debug (choice (const :tag "Disable" nil)
378 (integer :menu-tag "lines"
379 :format "%v")
79221864 380 (other :tag "Unlimited" t)))
daba3e25 381 (unibyte-display-via-language-environment mule boolean)
bf247b6e 382 (blink-cursor-alist cursor alist "22.1")
03c25271 383 (overline-margin display integer "22.1")
612c16f1
CY
384 (mouse-autoselect-window
385 display (choice
386 (const :tag "Off (nil)" :value nil)
387 (const :tag "Immediate" :value t)
388 (number :tag "Delay by secs" :value 0.5)) "22.1")
e5f51929 389 ;; xfaces.c
6671cab3 390 (scalable-fonts-allowed display boolean "22.1")
1444b0c0
PA
391 ;; xfns.c
392 (x-bitmap-file-path installation
0849a37e 393 (repeat (directory :format "%v")))
c4823934 394 (x-gtk-use-old-file-dialog menu boolean "22.1")
91b5a204 395 (x-gtk-show-hidden-files menu boolean "22.1")
c4823934 396 (x-gtk-file-dialog-help-text menu boolean "22.1")
0dd95b49 397 (x-gtk-whole-detached-tool-bar x boolean "22.1")
0849a37e 398 ;; xterm.c
4e371ce8 399 (x-use-underline-position-properties display boolean "22.1")
03c25271 400 (x-underline-at-descent-line display boolean "22.1")
37328bcd 401 (x-stretch-cursor display boolean "21.1")))
a200d998 402 this symbol group type standard version native-p
4883633e
RS
403 ;; This function turns a value
404 ;; into an expression which produces that value.
405 (quoter (lambda (sexp)
406 (if (or (memq sexp '(t nil))
017266f8 407 (keywordp sexp)
4883633e
RS
408 (and (listp sexp)
409 (memq (car sexp) '(lambda)))
410 (stringp sexp)
37328bcd 411 (numberp sexp))
4883633e
RS
412 sexp
413 (list 'quote sexp)))))
71296446 414 (while all
1444b0c0
PA
415 (setq this (car all)
416 all (cdr all)
417 symbol (nth 0 this)
418 group (nth 1 this)
00377857 419 type (nth 2 this)
37328bcd 420 version (nth 3 this)
a200d998
RS
421 ;; If we did not specify any standard value expression above,
422 ;; use the current value as the standard value.
423 standard (if (nthcdr 4 this)
424 (nth 4 this)
720f4c79 425 (when (default-boundp symbol)
92233e7e 426 (funcall quoter (default-value symbol))))
00377857
EZ
427 ;; Don't complain about missing variables which are
428 ;; irrelevant to this platform.
429 native-p (save-match-data
430 (cond
431 ((string-match "\\`dos-" (symbol-name symbol))
432 (eq system-type 'ms-dos))
433 ((string-match "\\`w32-" (symbol-name symbol))
434 (eq system-type 'windows-nt))
feba0cd6 435 ((string-match "\\`mac-" (symbol-name symbol))
ce00d093 436 (featurep 'mac-carbon))
2702394e 437 ((string-match "\\`x-.*gtk" (symbol-name symbol))
79cf2123 438 (featurep 'gtk))
197a09bf
EZ
439 ((string-match "\\`x-" (symbol-name symbol))
440 (fboundp 'x-create-frame))
6eb33acb
EZ
441 ((string-match "selection" (symbol-name symbol))
442 (fboundp 'x-selection-exists-p))
443 ((string-match "fringe" (symbol-name symbol))
444 (fboundp 'define-fringe-bitmap))
00377857 445 (t t))))
1444b0c0
PA
446 (if (not (boundp symbol))
447 ;; If variables are removed from C code, give an error here!
00377857
EZ
448 (and native-p
449 (message "Note, built-in variable `%S' not bound" symbol))
4883633e
RS
450 ;; Save the standard value, unless we already did.
451 (or (get symbol 'standard-value)
a200d998 452 (put symbol 'standard-value (list standard)))
4883633e
RS
453 ;; If this is NOT while dumping Emacs,
454 ;; set up the rest of the customization info.
455 (unless purify-flag
456 ;; Add it to the right group.
457 (custom-add-to-group group symbol 'custom-variable)
458 ;; Set the type.
37328bcd
DL
459 (put symbol 'custom-type type)
460 (put symbol 'custom-version version)))))
4883633e 461
ecf5279a 462(custom-add-to-group 'iswitchb 'read-buffer-function 'custom-variable)
779d0b80
DL
463(custom-add-to-group 'font-lock 'open-paren-in-column-0-is-defun-start
464 'custom-variable)
e5f51929
DL
465(put 'selection-coding-system 'custom-set
466 (lambda (symbol value)
467 (set-selection-coding-system value)
468 (set symbol value)))
ecf5279a 469
4883633e
RS
470;; Record cus-start as loaded
471;; if we have set up all the info that we can set up.
472;; Don't record cus-start as loaded
473;; if we have set up only the standard values.
474(unless purify-flag
475 (provide 'cus-start))
1444b0c0 476
c8f1ea76 477;; arch-tag: 4502730d-bcb3-4f5e-99a3-a86f2d54af60
1cd7adc6 478;;; cus-start.el ends here