;;; custom.el --- tools for declaring and initializing options
;;
;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Maintainer: FSF
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
(put symbol 'custom-get value))
((eq keyword :require)
(push value requests))
+ ((eq keyword :risky)
+ (put symbol 'risky-local-variable value))
+ ((eq keyword :safe)
+ (put symbol 'safe-local-variable value))
((eq keyword :type)
(put symbol 'custom-type (purecopy value)))
((eq keyword :options)
VALUE should be a feature symbol. If you save a value
for this option, then when your `.emacs' file loads the value,
it does (require VALUE) first.
+:risky Set SYMBOL's `risky-local-variable' property to VALUE.
+:safe Set SYMBOL's `safe-local-variable' property to VALUE.
The following common keywords are also meaningful.
SPEC should be an alist of the form ((DISPLAY ATTS)...).
-In the first element, DISPLAY can be :default. The ATTS in that
+In the first element, DISPLAY can be `default'. The ATTS in that
element then act as defaults for all the following elements.
Aside from that, DISPLAY specifies conditions to match some or
elements are ignored, on that frame.
In the last element, DISPLAY can be t. That element applies to a
-frame if none of the previous elements (except the :default if
+frame if none of the previous elements (except the `default' if
any) did.
ATTS is a list of face attributes followed by their values:
`:slant', `:underline', `:overline', `:strike-through', `:box',
`:foreground', `:background', `:stipple', `:inverse-video', and `:inherit'.
-DISPLAY can be `:default' (only in the first element), the symbol
+DISPLAY can be `default' (only in the first element), the symbol
t (only in the last element) to match all frames, or an alist of
conditions of the form \(REQ ITEM...). For such an alist to
match a frame, each of the conditions must be satisfied, meaning
(or (get variable 'standard-value)
(get variable 'custom-autoload)))
+(defun custom-note-var-changed (variable)
+ "Inform Custom that VARIABLE has been set (changed).
+VARIABLE is a symbol that names a user option.
+The result is that the change is treated as having been made through Custom."
+ (put variable 'customized-value (list (custom-quote (eval variable)))))
+
+\f
+;;; Custom Themes
+
;;; Loading files needed to customize a symbol.
;;; This is in custom.el because menu-bar.el needs it for toggle cmds.
(funcall variable (if value 1 0))))
(defun custom-quote (sexp)
- "Quote SEXP iff it is not self quoting."
+ "Quote SEXP if it is not self quoting."
(if (or (memq sexp '(t nil))
(keywordp sexp)
(and (listp sexp)
To actually save the value, call `custom-save-all'.
-Return non-nil iff the `saved-value' property actually changed."
+Return non-nil if the `saved-value' property actually changed."
(custom-load-symbol symbol)
(let* ((get (or (get symbol 'custom-get) 'default-value))
(value (funcall get symbol))
(saved (get symbol 'saved-value))
(standard (get symbol 'standard-value))
(comment (get symbol 'customized-variable-comment)))
- ;; Save default value iff different from standard value.
+ ;; Save default value if different from standard value.
(if (or (null standard)
(not (equal value (condition-case nil
(eval (car standard))
`customized-value' property to a list whose car evaluates to the
default value. Otherwise, set it to nil.
-Return non-nil iff the `customized-value' property actually changed."
+Return non-nil if the `customized-value' property actually changed."
(custom-load-symbol symbol)
(let* ((get (or (get symbol 'custom-get) 'default-value))
(value (funcall get symbol))
(customized (get symbol 'customized-value))
(old (or (get symbol 'saved-value) (get symbol 'standard-value))))
- ;; Mark default value as set iff different from old value.
+ ;; Mark default value as set if different from old value.
(if (not (and old
(equal value (condition-case nil
(eval (car old))
;;; Loading themes.
(defcustom custom-theme-directory
- (if (eq system-type 'ms-dos)
- ;; MS-DOS cannot have initial dot.
- "~/_emacs.d/"
- "~/.emacs.d/")
+ user-emacs-directory
"Directory in which Custom theme files should be written.
`load-theme' searches this directory in addition to load-path.
The command `customize-create-theme' writes the files it produces
(defun custom-theme-recalc-face (face)
"Set FACE according to currently enabled custom themes."
(if (facep face)
- (let ((theme-faces (reverse (get face 'theme-face))))
- (dolist (spec theme-faces)
- (face-spec-set face (cadr spec))))))
+ (face-spec-set face
+ (get (or (get face 'face-alias) face)
+ 'face-override-spec))))
\f
;;; XEmacs compability functions