X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/bdaf8a62d53cf8d5a0dc4f0dc530ecd6fc1f44fe..838d78d411955dbe3ef5d75ff404ced8ca832c5a:/lisp/custom.el diff --git a/lisp/custom.el b/lisp/custom.el index 5138f80097..22b6b20aa9 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1,7 +1,7 @@ ;;; 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 ;; Maintainer: FSF @@ -9,10 +9,10 @@ ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; 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 3, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,9 +20,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: ;; @@ -168,6 +166,10 @@ set to nil, as the value is no longer rogue." (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) @@ -219,6 +221,8 @@ The following keywords are meaningful: 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. @@ -573,6 +577,15 @@ This recursively follows aliases." (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))))) + + +;;; Custom Themes + ;;; Loading files needed to customize a symbol. ;;; This is in custom.el because menu-bar.el needs it for toggle cmds. @@ -885,7 +898,7 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')." (memq (get symbol 'custom-autoload) '(nil noset))) ;; This symbol needs to be autoloaded, even just for a `set'. (custom-load-symbol symbol)))) - + ;; Move minor modes and variables with explicit requires to the end. (setq args (sort args @@ -898,6 +911,8 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')." (error "Circular custom dependency between `%s' and `%s'" sym1 sym2)) (2-then-1 nil) + ;; 1 is a dependency of 2, so needs to be set first. + (1-then-2) ;; Put minor modes and symbols with :require last. ;; Putting minor modes last ensures that the mode ;; function will see other customized values rather @@ -1089,6 +1104,7 @@ This does not include the `user' theme, which is set by Customize, and always takes precedence over other Custom Themes." :group 'customize :type '(repeat symbol) + :set-after '(custom-theme-directory) ; so we can find the themes :set (lambda (symbol themes) ;; Avoid an infinite loop when custom-enabled-themes is ;; defined in a theme (e.g. `user'). Enabling the theme sets @@ -1161,9 +1177,9 @@ This function returns nil if no custom theme specifies a value for VARIABLE." (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)))) ;;; XEmacs compability functions