summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/eldoc.el
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2004-04-16 12:51:06 +0000
committerKenichi Handa <handa@m17n.org>2004-04-16 12:51:06 +0000
commit6b61353c0a0320ee15bb6488149735381fed62ec (patch)
treee69adba60e504a5a37beb556ad70084de88a7aab /lisp/emacs-lisp/eldoc.el
parentdc6a28319312fe81f7a1015e363174022313f0bd (diff)
downloademacs-6b61353c0a0320ee15bb6488149735381fed62ec.tar.gz
emacs-6b61353c0a0320ee15bb6488149735381fed62ec.tar.bz2
emacs-6b61353c0a0320ee15bb6488149735381fed62ec.zip
Sync to HEAD
Diffstat (limited to 'lisp/emacs-lisp/eldoc.el')
-rw-r--r--lisp/emacs-lisp/eldoc.el41
1 files changed, 28 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index cbcd5b2a555..bc868759d92 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -7,8 +7,6 @@
;; Keywords: extensions
;; Created: 1995-10-06
-;; $Id: eldoc.el,v 1.24 2003/02/11 00:11:55 monnier Exp $
-
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -40,11 +38,14 @@
;; One useful way to enable this minor mode is to put the following in your
;; .emacs:
;;
-;; (autoload 'turn-on-eldoc-mode "eldoc" nil t)
;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
;; (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
;; (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
+;; Major modes for other languages may use Eldoc by defining an
+;; appropriate function as the buffer-local value of
+;; `eldoc-print-current-symbol-info-function'.
+
;;; Code:
(require 'help-fns) ;For fundoc-usage handling functions.
@@ -233,19 +234,32 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
(not (eq (selected-window) (minibuffer-window)))))
+(defvar eldoc-print-current-symbol-info-function nil
+ "If non-nil, function to call to return doc string.
+The function of no args should return a one-line string for displaying
+doc about a function etc. appropriate to the context around point.
+It should return nil if there's no doc appropriate for the context.
+Typically doc is returned if point is on a function-like name or in its
+arg list.
+
+This variable is expected to be made buffer-local by modes (other than
+Emacs Lisp mode) that support Eldoc.")
+
(defun eldoc-print-current-symbol-info ()
(condition-case err
(and (eldoc-display-message-p)
- (let* ((current-symbol (eldoc-current-symbol))
- (current-fnsym (eldoc-fnsym-in-current-sexp))
- (doc (cond
- ((eq current-symbol current-fnsym)
- (or (eldoc-get-fnsym-args-string current-fnsym)
- (eldoc-get-var-docstring current-symbol)))
- (t
- (or (eldoc-get-var-docstring current-symbol)
- (eldoc-get-fnsym-args-string current-fnsym))))))
- (eldoc-message doc)))
+ (if eldoc-print-current-symbol-info-function
+ (eldoc-message (funcall eldoc-print-current-symbol-info-function))
+ (let* ((current-symbol (eldoc-current-symbol))
+ (current-fnsym (eldoc-fnsym-in-current-sexp))
+ (doc (cond
+ ((eq current-symbol current-fnsym)
+ (or (eldoc-get-fnsym-args-string current-fnsym)
+ (eldoc-get-var-docstring current-symbol)))
+ (t
+ (or (eldoc-get-var-docstring current-symbol)
+ (eldoc-get-fnsym-args-string current-fnsym))))))
+ (eldoc-message doc))))
;; This is run from post-command-hook or some idle timer thing,
;; so we need to be careful that errors aren't ignored.
(error (message "eldoc error: %s" err))))
@@ -451,4 +465,5 @@ With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
(provide 'eldoc)
+;;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375
;;; eldoc.el ends here