Mercurial > emacs
changeset 23962:5ab992b6ca59
(function-called-at-point): First look for function at point.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 30 Dec 1998 20:28:52 +0000 |
parents | 7a6b8dd13afb |
children | c242e2dc93a9 |
files | lisp/help.el |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/help.el Wed Dec 30 19:02:31 1998 +0000 +++ b/lisp/help.el Wed Dec 30 20:28:52 1998 +0000 @@ -507,8 +507,9 @@ C-w Display information on absence of warranty for GNU Emacs." help-map) -;; Return a function which is called by the list containing point. -;; If that gives no function, return a function whose name is around point. +;; Return a function whose name is around point. +;; If that gives no function, return a function which is called by the +;; list containing point. ;; If that doesn't give a function, return nil. (defun function-called-at-point () (let ((stab (syntax-table))) @@ -516,6 +517,16 @@ (unwind-protect (or (condition-case () (save-excursion + (or (not (zerop (skip-syntax-backward "_w"))) + (eq (char-syntax (following-char)) ?w) + (eq (char-syntax (following-char)) ?_) + (forward-sexp -1)) + (skip-chars-forward "'") + (let ((obj (read (current-buffer)))) + (and (symbolp obj) (fboundp obj) obj))) + (error nil)) + (condition-case () + (save-excursion (save-restriction (narrow-to-region (max (point-min) (- (point) 1000)) (point-max)) ;; Move up to surrounding paren, then after the open. @@ -528,16 +539,6 @@ (let (obj) (setq obj (read (current-buffer))) (and (symbolp obj) (fboundp obj) obj)))) - (error nil)) - (condition-case () - (save-excursion - (or (not (zerop (skip-syntax-backward "_w"))) - (eq (char-syntax (following-char)) ?w) - (eq (char-syntax (following-char)) ?_) - (forward-sexp -1)) - (skip-chars-forward "'") - (let ((obj (read (current-buffer)))) - (and (symbolp obj) (fboundp obj) obj))) (error nil))) (set-syntax-table stab))))