comparison lisp/help.el @ 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 81d1dacd379e
children 1876f867ff95
comparison
equal deleted inserted replaced
23961:7a6b8dd13afb 23962:5ab992b6ca59
505 C-n Display news of recent Emacs changes. 505 C-n Display news of recent Emacs changes.
506 C-p Display information about the GNU project. 506 C-p Display information about the GNU project.
507 C-w Display information on absence of warranty for GNU Emacs." 507 C-w Display information on absence of warranty for GNU Emacs."
508 help-map) 508 help-map)
509 509
510 ;; Return a function which is called by the list containing point. 510 ;; Return a function whose name is around point.
511 ;; If that gives no function, return a function whose name is around point. 511 ;; If that gives no function, return a function which is called by the
512 ;; list containing point.
512 ;; If that doesn't give a function, return nil. 513 ;; If that doesn't give a function, return nil.
513 (defun function-called-at-point () 514 (defun function-called-at-point ()
514 (let ((stab (syntax-table))) 515 (let ((stab (syntax-table)))
515 (set-syntax-table emacs-lisp-mode-syntax-table) 516 (set-syntax-table emacs-lisp-mode-syntax-table)
516 (unwind-protect 517 (unwind-protect
517 (or (condition-case () 518 (or (condition-case ()
519 (save-excursion
520 (or (not (zerop (skip-syntax-backward "_w")))
521 (eq (char-syntax (following-char)) ?w)
522 (eq (char-syntax (following-char)) ?_)
523 (forward-sexp -1))
524 (skip-chars-forward "'")
525 (let ((obj (read (current-buffer))))
526 (and (symbolp obj) (fboundp obj) obj)))
527 (error nil))
528 (condition-case ()
518 (save-excursion 529 (save-excursion
519 (save-restriction 530 (save-restriction
520 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max)) 531 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
521 ;; Move up to surrounding paren, then after the open. 532 ;; Move up to surrounding paren, then after the open.
522 (backward-up-list 1) 533 (backward-up-list 1)
526 (if (looking-at "[ \t]") 537 (if (looking-at "[ \t]")
527 (error "Probably not a Lisp function call")) 538 (error "Probably not a Lisp function call"))
528 (let (obj) 539 (let (obj)
529 (setq obj (read (current-buffer))) 540 (setq obj (read (current-buffer)))
530 (and (symbolp obj) (fboundp obj) obj)))) 541 (and (symbolp obj) (fboundp obj) obj))))
531 (error nil))
532 (condition-case ()
533 (save-excursion
534 (or (not (zerop (skip-syntax-backward "_w")))
535 (eq (char-syntax (following-char)) ?w)
536 (eq (char-syntax (following-char)) ?_)
537 (forward-sexp -1))
538 (skip-chars-forward "'")
539 (let ((obj (read (current-buffer))))
540 (and (symbolp obj) (fboundp obj) obj)))
541 (error nil))) 542 (error nil)))
542 (set-syntax-table stab)))) 543 (set-syntax-table stab))))
543 544
544 (defvar symbol-file-load-history-loaded nil 545 (defvar symbol-file-load-history-loaded nil
545 "Non-nil means we have loaded the file `fns-VERSION.el' in `exec-directory'. 546 "Non-nil means we have loaded the file `fns-VERSION.el' in `exec-directory'.