aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-06-24 18:35:06 +0000
committerRichard M. Stallman1998-06-24 18:35:06 +0000
commit7ddd6031265879bd0624b3fb47290b5ac2317010 (patch)
treeb8d12584521288f31bed7b85d53f66deb062a8e9
parent8a2ab0c6915d134196ed5738784d0bff4dc83bce (diff)
downloademacs-7ddd6031265879bd0624b3fb47290b5ac2317010.tar.gz
emacs-7ddd6031265879bd0624b3fb47290b5ac2317010.zip
(custom-set-default): New function.
(custom-set-variables): Use custom-set-default. (custom-local-buffer): New variable. (defcustom): Doc fix.
-rw-r--r--lisp/custom.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index 7994f3686c4..fd90be477b2 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -184,11 +184,11 @@ The following keywords are meaningful:
184 `custom-initialize-default' 184 `custom-initialize-default'
185:set VALUE should be a function to set the value of the symbol. 185:set VALUE should be a function to set the value of the symbol.
186 It takes two arguments, the symbol to set and the value to 186 It takes two arguments, the symbol to set and the value to
187 give it. The default choice of function is `set-default'. 187 give it. The default choice of function is `custom-set-default'.
188:get VALUE should be a function to extract the value of symbol. 188:get VALUE should be a function to extract the value of symbol.
189 The function takes one argument, a symbol, and should return 189 The function takes one argument, a symbol, and should return
190 the current value for that symbol. The default choice of function 190 the current value for that symbol. The default choice of function
191 is `default-value'. 191 is `custom-default-value'.
192:require 192:require
193 VALUE should be a feature symbol. If you save a value 193 VALUE should be a feature symbol. If you save a value
194 for this option, then when your `.emacs' file loads the value, 194 for this option, then when your `.emacs' file loads the value,
@@ -383,6 +383,14 @@ LOAD should be either a library file name, or a feature name."
383 383
384;;; Initializing. 384;;; Initializing.
385 385
386(defvar custom-local-buffer nil
387 "Non-nil, in a Customization buffer, means customize a specific buffer.
388If this variable is non-nil, it should be a buffer,
389and it means customize the local bindings of that buffer.
390This variable is a permanent local, and it normally has a local binding
391in every Customization buffer.")
392(put 'custom-local-buffer 'permanent-local t)
393
386(defun custom-set-variables (&rest args) 394(defun custom-set-variables (&rest args)
387 "Initialize variables according to user preferences. 395 "Initialize variables according to user preferences.
388 396
@@ -400,7 +408,7 @@ the default value for the SYMBOL."
400 (value (nth 1 entry)) 408 (value (nth 1 entry))
401 (now (nth 2 entry)) 409 (now (nth 2 entry))
402 (requests (nth 3 entry)) 410 (requests (nth 3 entry))
403 (set (or (get symbol 'custom-set) 'set-default))) 411 (set (or (get symbol 'custom-set) 'custom-set-default)))
404 (put symbol 'saved-value (list value)) 412 (put symbol 'saved-value (list value))
405 (cond (now 413 (cond (now
406 ;; Rogue variable, set it now. 414 ;; Rogue variable, set it now.
@@ -422,6 +430,16 @@ the default value for the SYMBOL."
422 (put symbol 'saved-value (list value))) 430 (put symbol 'saved-value (list value)))
423 (setq args (cdr (cdr args))))))) 431 (setq args (cdr (cdr args)))))))
424 432
433(defun custom-set-default (variable value)
434 "Default :set function for a customizable variable.
435Normally, this sets the default value of VARIABLE to VALUE,
436but if `custom-local-buffer' is non-nil,
437this sets the local binding in that buffer instead."
438 (if custom-local-buffer
439 (with-current-buffer custom-local-buffer
440 (set variable value))
441 (set-default variable value)))
442
425;;; The End. 443;;; The End.
426 444
427;; Process the defcustoms for variables loaded before this file. 445;; Process the defcustoms for variables loaded before this file.