237 |
(defun function-called-at-point () |
(defun function-called-at-point () |
238 |
"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. |
239 |
If that doesn't give a function, return nil." |
If that doesn't give a function, return nil." |
240 |
(with-syntax-table emacs-lisp-mode-syntax-table |
(or (with-syntax-table emacs-lisp-mode-syntax-table |
241 |
(or (condition-case () |
(or (condition-case () |
242 |
(save-excursion |
(save-excursion |
243 |
(or (not (zerop (skip-syntax-backward "_w"))) |
(or (not (zerop (skip-syntax-backward "_w"))) |
244 |
(eq (char-syntax (following-char)) ?w) |
(eq (char-syntax (following-char)) ?w) |
245 |
(eq (char-syntax (following-char)) ?_) |
(eq (char-syntax (following-char)) ?_) |
246 |
(forward-sexp -1)) |
(forward-sexp -1)) |
247 |
(skip-chars-forward "'") |
(skip-chars-forward "'") |
248 |
(let ((obj (read (current-buffer)))) |
(let ((obj (read (current-buffer)))) |
249 |
(and (symbolp obj) (fboundp obj) obj))) |
(and (symbolp obj) (fboundp obj) obj))) |
250 |
(error nil)) |
(error nil)) |
251 |
(condition-case () |
(condition-case () |
252 |
(save-excursion |
(save-excursion |
253 |
(save-restriction |
(save-restriction |
254 |
(narrow-to-region (max (point-min) |
(narrow-to-region (max (point-min) |
255 |
(- (point) 1000)) (point-max)) |
(- (point) 1000)) (point-max)) |
256 |
;; Move up to surrounding paren, then after the open. |
;; Move up to surrounding paren, then after the open. |
257 |
(backward-up-list 1) |
(backward-up-list 1) |
258 |
(forward-char 1) |
(forward-char 1) |
259 |
;; If there is space here, this is probably something |
;; If there is space here, this is probably something |
260 |
;; other than a real Lisp function call, so ignore it. |
;; other than a real Lisp function call, so ignore it. |
261 |
(if (looking-at "[ \t]") |
(if (looking-at "[ \t]") |
262 |
(error "Probably not a Lisp function call")) |
(error "Probably not a Lisp function call")) |
263 |
(let ((obj (read (current-buffer)))) |
(let ((obj (read (current-buffer)))) |
264 |
(and (symbolp obj) (fboundp obj) obj)))) |
(and (symbolp obj) (fboundp obj) obj)))) |
265 |
(error nil))))) |
(error nil)))) |
266 |
|
(let* ((str (find-tag-default)) |
267 |
|
(obj (if str (read str)))) |
268 |
|
(and (symbolp obj) (fboundp obj) obj)))) |
269 |
|
|
270 |
|
|
271 |
;;; `User' help functions |
;;; `User' help functions |