diff lisp/help-fns.el @ 90072:cb67264d6096

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12 Remove "-face" suffix from lazy-highlight face name * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40 Fix regressions from latest reftex update * miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2 Merge from miles@gnu.org--gnu-2004 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3 Merge from emacs--cvs-trunk--0
author Miles Bader <miles@gnu.org>
date Sun, 16 Jan 2005 03:40:12 +0000
parents 95879cc1ed20 ae92bd0348cd
children 72cf6261961e
line wrap: on
line diff
--- a/lisp/help-fns.el	Sun Jan 02 09:21:32 2005 +0000
+++ b/lisp/help-fns.el	Sun Jan 16 03:40:12 2005 +0000
@@ -216,6 +216,14 @@
 			(intern (upcase name))))))
 		arglist)))
 
+;;; Could be this, if we make symbol-file do the work below.
+;;; (defun help-C-file-name (subr-or-var kind)
+;;;   "Return the name of the C file where SUBR-OR-VAR is defined.
+;;; KIND should be `var' for a variable or `subr' for a subroutine."
+;;;   (symbol-file (if (symbolp subr-or-var) subr-or-var
+;;; 		 (subr-name subr-or-var))
+;;; 	       (if (eq kind 'var) 'defvar 'defun)))
+
 (defun help-C-file-name (subr-or-var kind)
   "Return the name of the C file where SUBR-OR-VAR is defined.
 KIND should be `var' for a variable or `subr' for a subroutine."
@@ -231,8 +239,8 @@
       (let ((file (catch 'loop
 		    (while t
 		      (let ((pnt (search-forward (concat "" name "\n"))))
-      (re-search-backward "S\\(.*\\)")
-      (let ((file (match-string 1)))
+			(re-search-backward "S\\(.*\\)")
+			(let ((file (match-string 1)))
 			  (if (member file build-files)
 			      (throw 'loop file)
 			    (goto-char pnt))))))))
@@ -463,9 +471,10 @@
 ;; Variables
 
 ;;;###autoload
-(defun variable-at-point ()
+(defun variable-at-point (&optional any-symbol)
   "Return the bound variable symbol found around point.
-Return 0 if there is no such symbol."
+Return 0 if there is no such symbol.
+If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
   (or (condition-case ()
 	  (with-syntax-table emacs-lisp-mode-syntax-table
 	    (save-excursion
@@ -479,12 +488,12 @@
 	(error nil))
       (let* ((str (find-tag-default))
 	     (sym (if str (intern-soft str))))
-	(if (and sym (boundp sym))
+	(if (and sym (or any-symbol (boundp sym)))
 	    sym
 	  (save-match-data
 	    (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
 	      (setq sym (intern-soft (match-string 1 str)))
-	      (and (boundp sym) sym)))))
+	      (and (or any-symbol (boundp sym)) sym)))))
       0))
 
 ;;;###autoload