aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1997-03-27 00:25:39 +0000
committerRichard M. Stallman <[email protected]>1997-03-27 00:25:39 +0000
commitc51f4e0d2c9429dde673f84d112120e5b36dcff7 (patch)
tree21bc6a762887ad92845cf2cc036e5adc85236ee2 /lisp/simple.el
parentfcd532ae8137bf4dbc42cd784aac4fad4d418a0d (diff)
(set-variable): Take default from `variable-at-point'.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 7f8aa1deff..3b7913ff75 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2979,7 +2979,15 @@ If you want VALUE to be a string, you must surround it with doublequotes.
If VARIABLE has a `variable-interactive' property, that is used as if
it were the arg to `interactive' (which see) to interactively read the value."
(interactive
- (let* ((var (read-variable "Set variable: "))
+ (let* ((var (let ((v (variable-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (completing-read (if v
+ (format "Set variable (default %s): " v)
+ "Set variable: ")
+ obarray 'boundp t))
+ (if (equal val "")
+ v (intern val))))
(minibuffer-help-form
'(funcall myhelp))
(myhelp