Mercurial > emacs
comparison lisp/cus-start.el @ 111573:e89dd9c3633b
merge trunk
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 08 Nov 2010 14:19:54 +0900 |
parents | c5f89cc4d275 |
children | 1303259207a9 |
comparison
equal
deleted
inserted
replaced
111572:b3f9490f0b7f | 111573:e89dd9c3633b |
---|---|
1 ;;; cus-start.el --- define customization properties of builtins | 1 ;;; cus-start.el --- define customization properties of builtins |
2 ;; | 2 ;; |
3 ;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, | 3 ;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 ;; 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
5 ;; | 5 ;; |
6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> | 6 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> |
7 ;; Keywords: internal | 7 ;; Keywords: internal |
8 ;; Package: emacs | 8 ;; Package: emacs |
9 | 9 |
32 ;; this file is loaded again with (require 'cus-start); | 32 ;; this file is loaded again with (require 'cus-start); |
33 ;; then it does the whole job. | 33 ;; then it does the whole job. |
34 | 34 |
35 ;;; Code: | 35 ;;; Code: |
36 | 36 |
37 ;; Elements of this list have the form: | |
38 ;; SYMBOL GROUP TYPE VERSION REST... | |
39 ;; SYMBOL is the name of the variable. | |
40 ;; GROUP is the custom group to which it belongs (may also be a list | |
41 ;; of groups) | |
42 ;; TYPE is the defcustom :type. | |
43 ;; VERSION is the defcustom :version (or nil). | |
44 ;; REST is a set of :KEYWORD VALUE pairs. Accepted :KEYWORDs are: | |
45 ;; :standard - standard value for SYMBOL (else use current value) | |
46 ;; :set - custom-set property | |
47 ;; :risky - risky-local-variable property | |
48 ;; :safe - safe-local-variable property | |
49 ;; :tag - custom-tag property | |
37 (let ((all '(;; alloc.c | 50 (let ((all '(;; alloc.c |
38 (gc-cons-threshold alloc integer) | 51 (gc-cons-threshold alloc integer) |
39 (garbage-collection-messages alloc boolean) | 52 (garbage-collection-messages alloc boolean) |
40 ;; buffer.c | 53 ;; buffer.c |
41 (mode-line-format mode-line sexp) ;Hard to do right. | 54 (mode-line-format mode-line sexp) ;Hard to do right. |
94 (scroll-down-aggressively windows | 107 (scroll-down-aggressively windows |
95 (choice (const :tag "off" nil) number) | 108 (choice (const :tag "off" nil) number) |
96 "21.1") | 109 "21.1") |
97 (line-spacing display (choice (const :tag "none" nil) integer) | 110 (line-spacing display (choice (const :tag "none" nil) integer) |
98 "22.1") | 111 "22.1") |
112 (cursor-in-non-selected-windows | |
113 cursor boolean nil | |
114 :tag "Cursor In Non-selected Windows" | |
115 :set #'(lambda (symbol value) | |
116 (set-default symbol value) | |
117 (force-mode-line-update t))) | |
118 (transient-mark-mode editing-basics boolean nil | |
119 :standard (not noninteractive) | |
120 :initialize custom-initialize-delay | |
121 :set custom-set-minor-mode) | |
99 ;; callint.c | 122 ;; callint.c |
100 (mark-even-if-inactive editing-basics boolean) | 123 (mark-even-if-inactive editing-basics boolean) |
101 ;; callproc.c | 124 ;; callproc.c |
102 (shell-file-name execute file) | 125 (shell-file-name execute file) |
103 (exec-path execute | 126 (exec-path execute |
164 (symbol :format "%v")) | 187 (symbol :format "%v")) |
165 (const :tag "always" t))) | 188 (const :tag "always" t))) |
166 ;; fileio.c | 189 ;; fileio.c |
167 (delete-by-moving-to-trash auto-save boolean "23.1") | 190 (delete-by-moving-to-trash auto-save boolean "23.1") |
168 (auto-save-visited-file-name auto-save boolean) | 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")) | |
218 (t | |
219 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") | |
220 "/tmp")))) | |
221 :initialize custom-initialize-delay) | |
169 ;; fns.c | 222 ;; fns.c |
170 (use-dialog-box menu boolean "21.1") | 223 (use-dialog-box menu boolean "21.1") |
171 (use-file-dialog menu boolean "22.1") | 224 (use-file-dialog menu boolean "22.1") |
172 (focus-follows-mouse frames boolean "20.3") | 225 (focus-follows-mouse frames boolean "20.3") |
173 ;; frame.c | 226 ;; frame.c |
178 (mouse-highlight mouse (choice (const :tag "disabled" nil) | 231 (mouse-highlight mouse (choice (const :tag "disabled" nil) |
179 (const :tag "always shown" t) | 232 (const :tag "always shown" t) |
180 (other :tag "hidden by keypress" 1)) | 233 (other :tag "hidden by keypress" 1)) |
181 "22.1") | 234 "22.1") |
182 (make-pointer-invisible mouse boolean "23.2") | 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) | |
183 ;; fringe.c | 243 ;; fringe.c |
184 (overflow-newline-into-fringe fringe boolean) | 244 (overflow-newline-into-fringe fringe boolean) |
185 ;; indent.c | 245 ;; indent.c |
186 (indent-tabs-mode indent boolean) | 246 (indent-tabs-mode indent boolean) |
187 ;; keyboard.c | 247 ;; keyboard.c |
325 (const :tag "Never (nil)" :value nil) | 385 (const :tag "Never (nil)" :value nil) |
326 (const :tag "Only on ttys" :value tty) | 386 (const :tag "Only on ttys" :value tty) |
327 (other :tag "Always" t)) | 387 (other :tag "Always" t)) |
328 "23.1") | 388 "23.1") |
329 ;; xdisp.c | 389 ;; xdisp.c |
390 (show-trailing-whitespace whitespace-faces boolean nil | |
391 :safe booleanp) | |
330 (scroll-step windows integer) | 392 (scroll-step windows integer) |
331 (scroll-conservatively windows integer) | 393 (scroll-conservatively windows integer) |
332 (scroll-margin windows integer) | 394 (scroll-margin windows integer) |
333 (hscroll-margin windows integer "22.1") | 395 (hscroll-margin windows integer "22.1") |
334 (hscroll-step windows number "22.1") | 396 (hscroll-step windows number "22.1") |
360 (const :tag "Both" :value both) | 422 (const :tag "Both" :value both) |
361 (const :tag "Both-horiz" :value both-horiz) | 423 (const :tag "Both-horiz" :value both-horiz) |
362 (const :tag "Text-image-horiz" :value text-image-horiz) | 424 (const :tag "Text-image-horiz" :value text-image-horiz) |
363 (const :tag "System default" :value nil)) "23.3") | 425 (const :tag "System default" :value nil)) "23.3") |
364 (tool-bar-max-label-size frames integer "23.3") | 426 (tool-bar-max-label-size frames integer "23.3") |
427 (auto-hscroll-mode scrolling boolean "21.1") | |
428 (display-hourglass cursor boolean) | |
429 (hourglass-delay cursor number) | |
365 | 430 |
366 ;; xfaces.c | 431 ;; xfaces.c |
367 (scalable-fonts-allowed display boolean "22.1") | 432 (scalable-fonts-allowed display boolean "22.1") |
368 ;; xfns.c | 433 ;; xfns.c |
369 (x-bitmap-file-path installation | 434 (x-bitmap-file-path installation |
377 (x-use-underline-position-properties display boolean "22.1") | 442 (x-use-underline-position-properties display boolean "22.1") |
378 (x-underline-at-descent-line display boolean "22.1") | 443 (x-underline-at-descent-line display boolean "22.1") |
379 (x-stretch-cursor display boolean "21.1") | 444 (x-stretch-cursor display boolean "21.1") |
380 ;; xsettings.c | 445 ;; xsettings.c |
381 (font-use-system-font font-selection boolean "23.2"))) | 446 (font-use-system-font font-selection boolean "23.2"))) |
382 this symbol group type standard version native-p | 447 this symbol group type standard version native-p rest prop propval |
383 ;; This function turns a value | 448 ;; This function turns a value |
384 ;; into an expression which produces that value. | 449 ;; into an expression which produces that value. |
385 (quoter (lambda (sexp) | 450 (quoter (lambda (sexp) |
386 (if (or (memq sexp '(t nil)) | 451 (if (or (memq sexp '(t nil)) |
387 (keywordp sexp) | 452 (keywordp sexp) |
396 all (cdr all) | 461 all (cdr all) |
397 symbol (nth 0 this) | 462 symbol (nth 0 this) |
398 group (nth 1 this) | 463 group (nth 1 this) |
399 type (nth 2 this) | 464 type (nth 2 this) |
400 version (nth 3 this) | 465 version (nth 3 this) |
466 rest (nthcdr 4 this) | |
401 ;; If we did not specify any standard value expression above, | 467 ;; If we did not specify any standard value expression above, |
402 ;; use the current value as the standard value. | 468 ;; use the current value as the standard value. |
403 standard (if (nthcdr 4 this) | 469 standard (if (setq prop (memq :standard rest)) |
404 (nth 4 this) | 470 (cadr prop) |
405 (when (default-boundp symbol) | 471 (if (default-boundp symbol) |
406 (funcall quoter (default-value symbol)))) | 472 (funcall quoter (default-value symbol)))) |
407 ;; Don't complain about missing variables which are | 473 ;; Don't complain about missing variables which are |
408 ;; irrelevant to this platform. | 474 ;; irrelevant to this platform. |
409 native-p (save-match-data | 475 native-p (save-match-data |
410 (cond | 476 (cond |
411 ((string-match "\\`dos-" (symbol-name symbol)) | 477 ((string-match "\\`dos-" (symbol-name symbol)) |
434 (and native-p | 500 (and native-p |
435 (message "Note, built-in variable `%S' not bound" symbol)) | 501 (message "Note, built-in variable `%S' not bound" symbol)) |
436 ;; Save the standard value, unless we already did. | 502 ;; Save the standard value, unless we already did. |
437 (or (get symbol 'standard-value) | 503 (or (get symbol 'standard-value) |
438 (put symbol 'standard-value (list standard))) | 504 (put symbol 'standard-value (list standard))) |
439 ;; If this is NOT while dumping Emacs, | 505 ;; We need these properties independent of whether cus-start is loaded. |
440 ;; set up the rest of the customization info. | 506 (if (setq prop (memq :safe rest)) |
507 (put symbol 'safe-local-variable (cadr prop))) | |
508 (if (setq prop (memq :risky rest)) | |
509 (put symbol 'risky-local-variable (cadr prop))) | |
510 (if (setq prop (memq :set rest)) | |
511 (put symbol 'custom-set (cadr prop))) | |
512 ;; Note this is the _only_ initialize property we handle. | |
513 (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay) | |
514 (push symbol custom-delayed-init-variables)) | |
515 ;; If this is NOT while dumping Emacs, set up the rest of the | |
516 ;; customization info. This is the stuff that is not needed | |
517 ;; until someone does M-x customize etc. | |
441 (unless purify-flag | 518 (unless purify-flag |
442 ;; Add it to the right group. | 519 ;; Add it to the right group(s). |
443 (custom-add-to-group group symbol 'custom-variable) | 520 (if (listp group) |
521 (dolist (g group) | |
522 (custom-add-to-group g symbol 'custom-variable)) | |
523 (custom-add-to-group group symbol 'custom-variable)) | |
444 ;; Set the type. | 524 ;; Set the type. |
445 (put symbol 'custom-type type) | 525 (put symbol 'custom-type type) |
446 (put symbol 'custom-version version))))) | 526 (if version (put symbol 'custom-version version)) |
527 (while rest | |
528 (setq prop (car rest) | |
529 propval (cadr rest) | |
530 rest (nthcdr 2 rest)) | |
531 (cond ((memq prop '(:standard :risky :safe :set))) ; handled above | |
532 ((eq prop :tag) | |
533 (put symbol 'custom-tag propval)))))))) | |
447 | 534 |
448 (custom-add-to-group 'iswitchb 'read-buffer-function 'custom-variable) | 535 (custom-add-to-group 'iswitchb 'read-buffer-function 'custom-variable) |
449 (custom-add-to-group 'font-lock 'open-paren-in-column-0-is-defun-start | 536 (custom-add-to-group 'font-lock 'open-paren-in-column-0-is-defun-start |
450 'custom-variable) | 537 'custom-variable) |
451 | 538 |
452 ;; Record cus-start as loaded | 539 ;; Record cus-start as loaded if we have set up all the info that we can. |
453 ;; if we have set up all the info that we can set up. | 540 ;; Don't record it as loaded if we have only set up the standard values |
454 ;; Don't record cus-start as loaded | 541 ;; and safe/risky properties. |
455 ;; if we have set up only the standard values. | |
456 (unless purify-flag | 542 (unless purify-flag |
457 (provide 'cus-start)) | 543 (provide 'cus-start)) |
458 | 544 |
459 ;; arch-tag: 4502730d-bcb3-4f5e-99a3-a86f2d54af60 | |
460 ;;; cus-start.el ends here | 545 ;;; cus-start.el ends here |