Commit 542e904c authored by Juri Linkov's avatar Juri Linkov
Browse files

(function-called-at-point): Try `find-tag-default' when other methods failed.

parent fc11ddc8
...@@ -237,32 +237,35 @@ C-w Display information on absence of warranty for GNU Emacs." ...@@ -237,32 +237,35 @@ C-w Display information on absence of warranty for GNU Emacs."
(defun function-called-at-point () (defun function-called-at-point ()
"Return a function around point or else called by the list containing point. "Return a function around point or else called by the list containing point.
If that doesn't give a function, return nil." If that doesn't give a function, return nil."
(with-syntax-table emacs-lisp-mode-syntax-table (or (with-syntax-table emacs-lisp-mode-syntax-table
(or (condition-case () (or (condition-case ()
(save-excursion (save-excursion
(or (not (zerop (skip-syntax-backward "_w"))) (or (not (zerop (skip-syntax-backward "_w")))
(eq (char-syntax (following-char)) ?w) (eq (char-syntax (following-char)) ?w)
(eq (char-syntax (following-char)) ?_) (eq (char-syntax (following-char)) ?_)
(forward-sexp -1)) (forward-sexp -1))
(skip-chars-forward "'") (skip-chars-forward "'")
(let ((obj (read (current-buffer)))) (let ((obj (read (current-buffer))))
(and (symbolp obj) (fboundp obj) obj))) (and (symbolp obj) (fboundp obj) obj)))
(error nil)) (error nil))
(condition-case () (condition-case ()
(save-excursion (save-excursion
(save-restriction (save-restriction
(narrow-to-region (max (point-min) (narrow-to-region (max (point-min)
(- (point) 1000)) (point-max)) (- (point) 1000)) (point-max))
;; Move up to surrounding paren, then after the open. ;; Move up to surrounding paren, then after the open.
(backward-up-list 1) (backward-up-list 1)
(forward-char 1) (forward-char 1)
;; If there is space here, this is probably something ;; If there is space here, this is probably something
;; other than a real Lisp function call, so ignore it. ;; other than a real Lisp function call, so ignore it.
(if (looking-at "[ \t]") (if (looking-at "[ \t]")
(error "Probably not a Lisp function call")) (error "Probably not a Lisp function call"))
(let ((obj (read (current-buffer)))) (let ((obj (read (current-buffer))))
(and (symbolp obj) (fboundp obj) obj)))) (and (symbolp obj) (fboundp obj) obj))))
(error nil))))) (error nil))))
(let* ((str (find-tag-default))
(obj (if str (read str))))
(and (symbolp obj) (fboundp obj) obj))))
;;; `User' help functions ;;; `User' help functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment