aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-01-05 01:09:23 +0000
committerRichard M. Stallman2005-01-05 01:09:23 +0000
commit20a514ceed5be18a60d1532e535e5119b7556929 (patch)
tree01c38c72fe8c78d9276feda524218b10d08c3770
parent0acffda1d3f09f708ce4909c53576dcce57babc0 (diff)
downloademacs-20a514ceed5be18a60d1532e535e5119b7556929.tar.gz
emacs-20a514ceed5be18a60d1532e535e5119b7556929.zip
(variable-at-point): New arg ANY-SYMBOL.
-rw-r--r--lisp/help-fns.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 522c1e2c19d..aaaff6903f2 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -463,9 +463,10 @@ face (according to `face-differs-from-default-p')."
463;; Variables 463;; Variables
464 464
465;;;###autoload 465;;;###autoload
466(defun variable-at-point () 466(defun variable-at-point (&optional any-symbol)
467 "Return the bound variable symbol found around point. 467 "Return the bound variable symbol found around point.
468Return 0 if there is no such symbol." 468Return 0 if there is no such symbol.
469If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
469 (or (condition-case () 470 (or (condition-case ()
470 (with-syntax-table emacs-lisp-mode-syntax-table 471 (with-syntax-table emacs-lisp-mode-syntax-table
471 (save-excursion 472 (save-excursion
@@ -479,12 +480,12 @@ Return 0 if there is no such symbol."
479 (error nil)) 480 (error nil))
480 (let* ((str (find-tag-default)) 481 (let* ((str (find-tag-default))
481 (sym (if str (intern-soft str)))) 482 (sym (if str (intern-soft str))))
482 (if (and sym (boundp sym)) 483 (if (and sym (or any-symbol (boundp sym)))
483 sym 484 sym
484 (save-match-data 485 (save-match-data
485 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) 486 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
486 (setq sym (intern-soft (match-string 1 str))) 487 (setq sym (intern-soft (match-string 1 str)))
487 (and (boundp sym) sym))))) 488 (and (or any-symbol (boundp sym)) sym)))))
488 0)) 489 0))
489 490
490;;;###autoload 491;;;###autoload