comparison 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
comparison
equal deleted inserted replaced
90071:f6b4d0ebf147 90072:cb67264d6096
214 (let ((name (symbol-name arg))) 214 (let ((name (symbol-name arg)))
215 (if (string-match "\\`&" name) arg 215 (if (string-match "\\`&" name) arg
216 (intern (upcase name)))))) 216 (intern (upcase name))))))
217 arglist))) 217 arglist)))
218 218
219 ;;; Could be this, if we make symbol-file do the work below.
220 ;;; (defun help-C-file-name (subr-or-var kind)
221 ;;; "Return the name of the C file where SUBR-OR-VAR is defined.
222 ;;; KIND should be `var' for a variable or `subr' for a subroutine."
223 ;;; (symbol-file (if (symbolp subr-or-var) subr-or-var
224 ;;; (subr-name subr-or-var))
225 ;;; (if (eq kind 'var) 'defvar 'defun)))
226
219 (defun help-C-file-name (subr-or-var kind) 227 (defun help-C-file-name (subr-or-var kind)
220 "Return the name of the C file where SUBR-OR-VAR is defined. 228 "Return the name of the C file where SUBR-OR-VAR is defined.
221 KIND should be `var' for a variable or `subr' for a subroutine." 229 KIND should be `var' for a variable or `subr' for a subroutine."
222 (let ((docbuf (get-buffer-create " *DOC*")) 230 (let ((docbuf (get-buffer-create " *DOC*"))
223 (name (if (eq 'var kind) 231 (name (if (eq 'var kind)
229 (insert-file-contents-literally 237 (insert-file-contents-literally
230 (expand-file-name internal-doc-file-name doc-directory))) 238 (expand-file-name internal-doc-file-name doc-directory)))
231 (let ((file (catch 'loop 239 (let ((file (catch 'loop
232 (while t 240 (while t
233 (let ((pnt (search-forward (concat "" name "\n")))) 241 (let ((pnt (search-forward (concat "" name "\n"))))
234 (re-search-backward "S\\(.*\\)") 242 (re-search-backward "S\\(.*\\)")
235 (let ((file (match-string 1))) 243 (let ((file (match-string 1)))
236 (if (member file build-files) 244 (if (member file build-files)
237 (throw 'loop file) 245 (throw 'loop file)
238 (goto-char pnt)))))))) 246 (goto-char pnt))))))))
239 (if (string-match "\\.\\(o\\|obj\\)\\'" file) 247 (if (string-match "\\.\\(o\\|obj\\)\\'" file)
240 (setq file (replace-match ".c" t t file))) 248 (setq file (replace-match ".c" t t file)))
461 469
462 470
463 ;; Variables 471 ;; Variables
464 472
465 ;;;###autoload 473 ;;;###autoload
466 (defun variable-at-point () 474 (defun variable-at-point (&optional any-symbol)
467 "Return the bound variable symbol found around point. 475 "Return the bound variable symbol found around point.
468 Return 0 if there is no such symbol." 476 Return 0 if there is no such symbol.
477 If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
469 (or (condition-case () 478 (or (condition-case ()
470 (with-syntax-table emacs-lisp-mode-syntax-table 479 (with-syntax-table emacs-lisp-mode-syntax-table
471 (save-excursion 480 (save-excursion
472 (or (not (zerop (skip-syntax-backward "_w"))) 481 (or (not (zerop (skip-syntax-backward "_w")))
473 (eq (char-syntax (following-char)) ?w) 482 (eq (char-syntax (following-char)) ?w)
477 (let ((obj (read (current-buffer)))) 486 (let ((obj (read (current-buffer))))
478 (and (symbolp obj) (boundp obj) obj)))) 487 (and (symbolp obj) (boundp obj) obj))))
479 (error nil)) 488 (error nil))
480 (let* ((str (find-tag-default)) 489 (let* ((str (find-tag-default))
481 (sym (if str (intern-soft str)))) 490 (sym (if str (intern-soft str))))
482 (if (and sym (boundp sym)) 491 (if (and sym (or any-symbol (boundp sym)))
483 sym 492 sym
484 (save-match-data 493 (save-match-data
485 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) 494 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str))
486 (setq sym (intern-soft (match-string 1 str))) 495 (setq sym (intern-soft (match-string 1 str)))
487 (and (boundp sym) sym))))) 496 (and (or any-symbol (boundp sym)) sym)))))
488 0)) 497 0))
489 498
490 ;;;###autoload 499 ;;;###autoload
491 (defun describe-variable (variable &optional buffer) 500 (defun describe-variable (variable &optional buffer)
492 "Display the full documentation of VARIABLE (a symbol). 501 "Display the full documentation of VARIABLE (a symbol).