]> code.delx.au - gnu-emacs/blob - lisp/cus-start.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / cus-start.el
1 ;;; cus-start.el --- define customization properties of builtins
2 ;;
3 ;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5 ;;
6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
7 ;; Keywords: internal
8
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
13 ;; the Free Software Foundation; either version 3, or (at your option)
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
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 ;;; Commentary:
27 ;;
28 ;; This file adds customize support for built-in variables.
29
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.
35
36 ;;; Code:
37
38 (let ((all '(;; alloc.c
39 (gc-cons-threshold alloc integer)
40 (garbage-collection-messages alloc boolean)
41 ;; buffer.c
42 (mode-line-format mode-line sexp) ;Hard to do right.
43 (default-major-mode internal function)
44 (enable-multibyte-characters mule boolean)
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)
51 (selective-display-ellipses display boolean)
52 (indicate-empty-lines fringe boolean)
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)
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 \
63 for individual indicators.
64 Leaving \"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))))
91 (other :tag "On left, no arrows" t)))
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")
98 (line-spacing display (choice (const :tag "none" nil) integer))
99 ;; callint.c
100 (mark-even-if-inactive editing-basics boolean)
101 ;; callproc.c
102 (shell-file-name execute file)
103 (exec-path execute
104 (repeat (choice (const :tag "default directory" nil)
105 (directory :format "%v"))))
106 ;; charset.c
107 (charset-map-path installation
108 (repeat (directory :format "%v")))
109 ;; coding.c
110 (inhibit-eol-conversion mule boolean)
111 (eol-mnemonic-undecided mule string)
112 (eol-mnemonic-unix mule string)
113 (eol-mnemonic-dos mule string)
114 (eol-mnemonic-mac mule string)
115 (file-coding-system-alist
116 mule
117 (alist
118 :key-type (regexp :tag "File regexp")
119 :value-type (choice
120 :value (undecided . undecided)
121 (cons :tag "Encoding/decoding pair"
122 :value (undecided . undecided)
123 (coding-system :tag "Decoding")
124 (coding-system :tag "Encoding"))
125 (coding-system
126 :tag "Single coding system"
127 :value undecided
128 :match (lambda (widget value)
129 (and value (not (functionp value)))))
130 (function :value ignore))))
131 (selection-coding-system mule coding-system)
132 ;; dired.c
133 (completion-ignored-extensions dired
134 (repeat (string :format "%v")))
135 ;; dispnew.c
136 (baud-rate display integer)
137 (inverse-video display boolean)
138 (visible-bell display boolean)
139 (no-redraw-on-reenter display boolean)
140 ;; editfns.c
141 (user-full-name mail string)
142 ;; eval.c
143 (max-specpdl-size limits integer)
144 (max-lisp-eval-depth limits integer)
145 (max-mini-window-height limits
146 (choice (const :tag "quarter screen" nil)
147 number))
148 (stack-trace-on-error debug
149 (choice (const :tag "off")
150 (repeat :menu-tag "When"
151 :value (nil)
152 (symbol :format "%v"))
153 (const :tag "always" t)))
154 (debug-on-error debug
155 (choice (const :tag "off")
156 (repeat :menu-tag "When"
157 :value (nil)
158 (symbol :format "%v"))
159 (const :tag "always" t)))
160 (debug-ignored-errors debug (repeat (choice symbol regexp)))
161 (debug-on-quit debug
162 (choice (const :tag "off")
163 (repeat :menu-tag "When"
164 :value (nil)
165 (symbol :format "%v"))
166 (const :tag "always" t)))
167 ;; fileio.c
168 (insert-default-directory minibuffer boolean)
169 (read-file-name-completion-ignore-case minibuffer boolean "22.1")
170 ;; fns.c
171 (use-dialog-box menu boolean "21.1")
172 (use-file-dialog menu boolean "22.1")
173 (focus-follows-mouse frames boolean "20.3")
174 ;; frame.c
175 (default-frame-alist frames
176 (repeat (cons :format "%v"
177 (symbol :tag "Parameter")
178 (sexp :tag "Value"))))
179 (mouse-highlight mouse (choice (const :tag "disabled" nil)
180 (const :tag "always shown" t)
181 (other :tag "hidden by keypress" 1)))
182 ;; fringe.c
183 (overflow-newline-into-fringe fringe boolean)
184 ;; indent.c
185 (indent-tabs-mode indent boolean)
186 ;; keyboard.c
187 (meta-prefix-char keyboard character)
188 (auto-save-interval auto-save integer)
189 (auto-save-timeout auto-save (choice (const :tag "off" nil)
190 (integer :format "%v")))
191 (echo-keystrokes minibuffer number)
192 (polling-period keyboard integer)
193 (double-click-time mouse (restricted-sexp
194 :match-alternatives (integerp 'nil 't)))
195 (double-click-fuzz mouse integer)
196 (inhibit-local-menu-bar-menus menu boolean)
197 (help-char keyboard character)
198 (help-event-list keyboard (repeat (sexp :format "%v")))
199 (menu-prompting menu boolean)
200 (suggest-key-bindings keyboard (choice (const :tag "off" nil)
201 (integer :tag "time" 2)
202 (other :tag "on")))
203 ;; macselect.c
204 (mac-dnd-known-types mac (repeat string) "22.1")
205 ;; macterm.c
206 (mac-control-modifier mac (choice (const :tag "No modifier" nil)
207 (const control) (const meta)
208 (const alt) (const hyper)
209 (const super)) "22.1")
210 (mac-command-modifier mac (choice (const :tag "No modifier" nil)
211 (const control) (const meta)
212 (const alt) (const hyper)
213 (const super)) "22.1")
214 (mac-option-modifier mac (choice (const :tag "No modifier (work as option)" nil)
215 (const control) (const meta)
216 (const alt) (const hyper)
217 (const super)) "22.1")
218 (mac-function-modifier mac
219 (choice (const :tag "No modifier (work as function)" nil)
220 (const control) (const meta)
221 (const alt) (const hyper)
222 (const super)) "22.1")
223 (mac-emulate-three-button-mouse mac
224 (choice (const :tag "No emulation" nil)
225 (const :tag "Option->2, Command->3" t)
226 (const :tag "Command->2, Option->3" reverse))
227 "22.1")
228 (mac-wheel-button-is-mouse-2 mac boolean "22.1")
229 (mac-pass-command-to-system mac boolean "22.1")
230 (mac-pass-control-to-system mac boolean "22.1")
231 (mac-allow-anti-aliasing mac boolean "22.1")
232 (mac-ts-script-language-on-focus mac
233 (choice (const :tag "System default behavior" nil)
234 (const :tag "Restore to script/language used in the last focus frame" t)
235 (cons :tag "Specify script/language"
236 (integer :tag "Script code")
237 (integer :tag "Language code")))
238 "22.1")
239
240 ;; This is not good news because it will use the wrong
241 ;; version-specific directories when you upgrade. We need
242 ;; customization of the front of the list, maintaining the standard
243 ;; value intact at the back.
244 ;;; (load-path environment
245 ;;; (repeat (choice :tag "[Current dir?]"
246 ;;; :format "%[Current dir?%] %v"
247 ;;; (const :tag " current dir" nil)
248 ;;; (directory :format "%v"))))
249 ;; minibuf.c
250 (completion-auto-help minibuffer boolean)
251 (enable-recursive-minibuffers minibuffer boolean)
252 (history-length minibuffer
253 (choice (const :tag "Infinite" t)
254 integer))
255 (history-delete-duplicates minibuffer boolean)
256 (minibuffer-prompt-properties
257 minibuffer
258 (list
259 (checklist :inline t
260 (const :tag "Read-Only"
261 :doc "Prevent prompt from being modified"
262 :format "%t%n%h"
263 :inline t
264 (read-only t))
265 (const :tag "Don't Enter"
266 :doc "Prevent point from ever entering prompt"
267 :format "%t%n%h"
268 :inline t
269 (point-entered minibuffer-avoid-prompt)))
270 (repeat :inline t
271 :tag "Other Properties"
272 (list :inline t
273 :format "%v"
274 (symbol :tag "Property")
275 (sexp :tag "Value"))))
276 "21.1")
277 (minibuffer-auto-raise minibuffer boolean)
278 ;; options property set at end
279 (read-buffer-function minibuffer
280 (choice (const nil)
281 (function-item iswitchb-read-buffer)
282 function))
283 ;; msdos.c
284 (dos-unsupported-char-glyph display integer)
285 ;; process.c
286 (delete-exited-processes processes-basics boolean)
287 ;; syntax.c
288 (parse-sexp-ignore-comments editing-basics boolean)
289 (words-include-escapes editing-basics boolean)
290 (open-paren-in-column-0-is-defun-start editing-basics boolean
291 "21.1")
292 ;; term.c
293 (visible-cursor cursor boolean "22.1")
294 ;; undo.c
295 (undo-limit undo integer)
296 (undo-strong-limit undo integer)
297 (undo-outer-limit undo
298 (choice integer
299 (const :tag "No limit"
300 :format "%t\n%d"
301 :doc
302 "With this choice, \
303 the undo info for the current command never gets discarded.
304 This should only be chosen under exceptional circumstances,
305 since it could result in memory overflow and make Emacs crash."
306 nil))
307 "22.1")
308 ;; window.c
309 (temp-buffer-show-function windows (choice (const nil) function))
310 (display-buffer-function windows (choice (const nil) function))
311 (pop-up-frames frames boolean)
312 (pop-up-frame-function frames function)
313 (special-display-buffer-names
314 frames
315 (repeat (choice :tag "Buffer"
316 :value ""
317 (string :format "%v")
318 (cons :tag "With attributes"
319 :format "%v"
320 :value ("" . nil)
321 (string :format "%v")
322 (repeat :tag "Attributes"
323 (cons :format "%v"
324 (symbol :tag "Parameter")
325 (sexp :tag "Value")))))))
326 (special-display-regexps
327 frames
328 (repeat (choice :tag "Buffer"
329 :value ""
330 (regexp :format "%v")
331 (cons :tag "With attributes"
332 :format "%v"
333 :value ("" . nil)
334 (regexp :format "%v")
335 (repeat :tag "Attributes"
336 (cons :format "%v"
337 (symbol :tag "Parameter")
338 (sexp :tag "Value")))))))
339 (special-display-function frames function)
340 (same-window-buffer-names windows (repeat (string :format "%v")))
341 (same-window-regexps windows (repeat (regexp :format "%v")))
342 (pop-up-windows windows boolean)
343 (even-window-heights windows boolean)
344 (next-screen-context-lines windows integer)
345 (split-height-threshold windows integer)
346 (split-window-preferred-function
347 windows
348 (choice (const :tag "vertically" split-window)
349 ;; FIXME: Add `sensibly' which chooses between
350 ;; vertical or horizontal splits depending on the size
351 ;; and shape of the window.
352 (const :tag "horizontally"
353 (lambda (window)
354 (split-window window nil 'horiz)))))
355 (window-min-height windows integer)
356 (window-min-width windows integer)
357 (scroll-preserve-screen-position
358 windows (choice
359 (const :tag "Off (nil)" :value nil)
360 (const :tag "Full screen (t)" :value t)
361 (other :tag "Always" 1)))
362 (display-buffer-reuse-frames windows boolean "21.1")
363 ;; xdisp.c
364 (scroll-step windows integer)
365 (scroll-conservatively windows integer)
366 (scroll-margin windows integer)
367 (hscroll-margin windows integer "22.1")
368 (hscroll-step windows number "22.1")
369 (truncate-partial-width-windows display boolean)
370 (mode-line-inverse-video mode-line boolean)
371 (mode-line-in-non-selected-windows mode-line boolean "22.1")
372 (line-number-display-limit display
373 (choice integer
374 (const :tag "No limit" nil)))
375 (line-number-display-limit-width display integer)
376 (highlight-nonselected-windows display boolean)
377 (message-log-max debug (choice (const :tag "Disable" nil)
378 (integer :menu-tag "lines"
379 :format "%v")
380 (other :tag "Unlimited" t)))
381 (unibyte-display-via-language-environment mule boolean)
382 (blink-cursor-alist cursor alist "22.1")
383 (overline-margin display integer "22.1")
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")
389 ;; xfaces.c
390 (scalable-fonts-allowed display boolean)
391 ;; xfns.c
392 (x-bitmap-file-path installation
393 (repeat (directory :format "%v")))
394 (x-gtk-use-old-file-dialog menu boolean "22.1")
395 (x-gtk-show-hidden-files menu boolean "22.1")
396 (x-gtk-file-dialog-help-text menu boolean "22.1")
397 (x-gtk-whole-detached-tool-bar x boolean "22.1")
398 ;; xterm.c
399 (x-use-underline-position-properties display boolean "22.1")
400 (x-underline-at-descent-line display boolean "22.1")
401 (x-stretch-cursor display boolean "21.1")))
402 this symbol group type standard version native-p
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))
407 (keywordp sexp)
408 (and (listp sexp)
409 (memq (car sexp) '(lambda)))
410 (stringp sexp)
411 (numberp sexp))
412 sexp
413 (list 'quote sexp)))))
414 (while all
415 (setq this (car all)
416 all (cdr all)
417 symbol (nth 0 this)
418 group (nth 1 this)
419 type (nth 2 this)
420 version (nth 3 this)
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)
425 (when (default-boundp symbol)
426 (funcall quoter (default-value symbol))))
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))
435 ((string-match "\\`mac-" (symbol-name symbol))
436 (featurep 'mac-carbon))
437 ((string-match "\\`x-.*gtk" (symbol-name symbol))
438 (featurep 'gtk))
439 ((string-match "\\`x-" (symbol-name symbol))
440 (fboundp 'x-create-frame))
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))
445 (t t))))
446 (if (not (boundp symbol))
447 ;; If variables are removed from C code, give an error here!
448 (and native-p
449 (message "Note, built-in variable `%S' not bound" symbol))
450 ;; Save the standard value, unless we already did.
451 (or (get symbol 'standard-value)
452 (put symbol 'standard-value (list standard)))
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.
459 (put symbol 'custom-type type)
460 (put symbol 'custom-version version)))))
461
462 (custom-add-to-group 'iswitchb 'read-buffer-function 'custom-variable)
463 (custom-add-to-group 'font-lock 'open-paren-in-column-0-is-defun-start
464 'custom-variable)
465 (put 'selection-coding-system 'custom-set
466 (lambda (symbol value)
467 (set-selection-coding-system value)
468 (set symbol value)))
469
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))
476
477 ;; arch-tag: 4502730d-bcb3-4f5e-99a3-a86f2d54af60
478 ;;; cus-start.el ends here