/[emacs]/emacs/lisp/simple.el
ViewVC logotype

Diff of /emacs/lisp/simple.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.560 by rms, Tue Jul 23 19:25:27 2002 UTC revision 1.561 by rms, Fri Aug 9 14:14:06 2002 UTC
# Line 3634  Each action has the form (FUNCTION . ARG Line 3634  Each action has the form (FUNCTION . ARG
3634  (defvar set-variable-value-history nil  (defvar set-variable-value-history nil
3635    "History of values entered with `set-variable'.")    "History of values entered with `set-variable'.")
3636    
3637  (defun set-variable (var val)  (defun set-variable (var val &optional make-local)
3638    "Set VARIABLE to VALUE.  VALUE is a Lisp object.    "Set VARIABLE to VALUE.  VALUE is a Lisp object.
3639  When using this interactively, enter a Lisp object for VALUE.  When using this interactively, enter a Lisp object for VALUE.
3640  If you want VALUE to be a string, you must surround it with doublequotes.  If you want VALUE to be a string, you must surround it with doublequotes.
# Line 3644  If VARIABLE has a `variable-interactive' Line 3644  If VARIABLE has a `variable-interactive'
3644  it were the arg to `interactive' (which see) to interactively read VALUE.  it were the arg to `interactive' (which see) to interactively read VALUE.
3645    
3646  If VARIABLE has been defined with `defcustom', then the type information  If VARIABLE has been defined with `defcustom', then the type information
3647  in the definition is used to check that VALUE is valid."  in the definition is used to check that VALUE is valid.
3648    
3649    With a prefix argument, set VARIABLE to VALUE buffer-locally."
3650    (interactive    (interactive
3651     (let* ((default-var (variable-at-point))     (let* ((default-var (variable-at-point))
3652            (var (if (symbolp default-var)            (var (if (symbolp default-var)
# Line 3653  in the definition is used to check that Line 3655  in the definition is used to check that
3655                   (read-variable "Set variable: ")))                   (read-variable "Set variable: ")))
3656                        (minibuffer-help-form '(describe-variable var))                        (minibuffer-help-form '(describe-variable var))
3657                        (prop (get var 'variable-interactive))                        (prop (get var 'variable-interactive))
3658                        (prompt (format "Set %s to value: " var))                        (prompt (format "Set %s%s to value: " var
3659                                          (cond ((local-variable-p var)
3660                                                 " (buffer-local)")
3661                                                ((or current-prefix-arg
3662                                                     (local-variable-if-set-p var))
3663                                                 " buffer-locally")
3664                                                (t " globally"))))
3665                        (val (if prop                        (val (if prop
3666                                 ;; Use VAR's `variable-interactive' property                                 ;; Use VAR's `variable-interactive' property
3667                                 ;; as an interactive spec for prompting.                                 ;; as an interactive spec for prompting.
# Line 3663  in the definition is used to check that Line 3671  in the definition is used to check that
3671                               (read                               (read
3672                                (read-string prompt nil                                (read-string prompt nil
3673                                             'set-variable-value-history)))))                                             'set-variable-value-history)))))
3674                   (list var val)))                   (list var val current-prefix-arg)))
3675    
3676    (let ((type (get var 'custom-type)))    (let ((type (get var 'custom-type)))
3677      (when type      (when type
# Line 3673  in the definition is used to check that Line 3681  in the definition is used to check that
3681        (unless (widget-apply type :match val)        (unless (widget-apply type :match val)
3682          (error "Value `%S' does not match type %S of %S"          (error "Value `%S' does not match type %S of %S"
3683                 val (car type) var))))                 val (car type) var))))
3684    
3685      (if make-local
3686          (make-local-variable var))
3687            
3688    (set var val)    (set var val)
3689    
3690    ;; Force a thorough redisplay for the case that the variable    ;; Force a thorough redisplay for the case that the variable

Legend:
Removed from v.1.560  
changed lines
  Added in v.1.561

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26