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