From 16236388b2396a28deb625c9ecc98978b8065f96 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 9 Aug 2002 14:14:32 +0000 Subject: [PATCH] (set-variable): If given a prefix argument, set variable buffer-locally. Give locality status in prompt. --- lisp/ChangeLog | 19 +++++++++++++++++++ lisp/simple.el | 20 ++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e91201a16f9..c289d76e7e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,26 @@ +2002-08-09 Richard M. Stallman + + * simple.el (set-variable): Give locality status in prompt. + +2002-08-09 Benjamin Rutt + + * simple.el (set-variable): If given a prefix argument, set + variable buffer-locally. + 2002-08-09 John Paul Wallington * font-core.el (font-lock-function): Make it buffer-local. +2002-08-08 Richard M. Stallman + + * emacs-lisp/checkdoc.el (checkdoc, checkdoc-interactive) + (checkdoc-message-interactive, checkdoc-interactive-loop) + (checkdoc-current-buffer, checkdoc-continue, checkdoc-comments) + (checkdoc-defun): + Update checkdoc-spellcheck-documentation-flag correctly. + (checkdoc-ispell-docstring-engine): Don't test for + checkdoc-autofix-flag = nil. + 2002-08-07 John Paul Wallington * xt-mouse.el (xterm-mouse-mode): Make it a global mode. diff --git a/lisp/simple.el b/lisp/simple.el index 2b3193ced2d..6b2700f5b7f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3634,7 +3634,7 @@ Each action has the form (FUNCTION . ARGS)." (defvar set-variable-value-history nil "History of values entered with `set-variable'.") -(defun set-variable (var val) +(defun set-variable (var val &optional make-local) "Set VARIABLE to VALUE. VALUE is a Lisp object. When using this interactively, enter a Lisp object for VALUE. If you want VALUE to be a string, you must surround it with doublequotes. @@ -3644,7 +3644,9 @@ If VARIABLE has a `variable-interactive' property, that is used as if it were the arg to `interactive' (which see) to interactively read VALUE. If VARIABLE has been defined with `defcustom', then the type information -in the definition is used to check that VALUE is valid." +in the definition is used to check that VALUE is valid. + +With a prefix argument, set VARIABLE to VALUE buffer-locally." (interactive (let* ((default-var (variable-at-point)) (var (if (symbolp default-var) @@ -3653,7 +3655,13 @@ in the definition is used to check that VALUE is valid." (read-variable "Set variable: "))) (minibuffer-help-form '(describe-variable var)) (prop (get var 'variable-interactive)) - (prompt (format "Set %s to value: " var)) + (prompt (format "Set %s%s to value: " var + (cond ((local-variable-p var) + " (buffer-local)") + ((or current-prefix-arg + (local-variable-if-set-p var)) + " buffer-locally") + (t " globally")))) (val (if prop ;; Use VAR's `variable-interactive' property ;; as an interactive spec for prompting. @@ -3663,7 +3671,7 @@ in the definition is used to check that VALUE is valid." (read (read-string prompt nil 'set-variable-value-history))))) - (list var val))) + (list var val current-prefix-arg))) (let ((type (get var 'custom-type))) (when type @@ -3673,6 +3681,10 @@ in the definition is used to check that VALUE is valid." (unless (widget-apply type :match val) (error "Value `%S' does not match type %S of %S" val (car type) var)))) + + (if make-local + (make-local-variable var)) + (set var val) ;; Force a thorough redisplay for the case that the variable -- 2.39.5