/[emacs]/emacs/lisp/emacs-lisp/eldoc.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/eldoc.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20.4.1 by miles, Fri Apr 4 06:20:16 2003 UTC revision 1.20.4.2 by miles, Tue Oct 14 23:32:21 2003 UTC
# Line 40  Line 40 
40  ;; One useful way to enable this minor mode is to put the following in your  ;; One useful way to enable this minor mode is to put the following in your
41  ;; .emacs:  ;; .emacs:
42  ;;  ;;
 ;;      (autoload 'turn-on-eldoc-mode "eldoc" nil t)  
43  ;;      (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)  ;;      (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
44  ;;      (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)  ;;      (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
45  ;;      (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)  ;;      (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
46    
47    ;; Major modes for other languages may use Eldoc by defining an
48    ;; appropriate function as the buffer-local value of
49    ;; `eldoc-print-current-symbol-info-function'.
50    
51  ;;; Code:  ;;; Code:
52    
53  (require 'help-fns)                    ;For fundoc-usage handling functions.  (require 'help-fns)                    ;For fundoc-usage handling functions.
# Line 81  returns another string is acceptable." Line 84  returns another string is acceptable."
84    
85  (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit  (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
86    "*Allow long eldoc messages to resize echo area display.    "*Allow long eldoc messages to resize echo area display.
87  If value is `t', never attempt to truncate messages; complete symbol name  If value is t, never attempt to truncate messages; complete symbol name
88  and function arglist or 1-line variable documentation will be displayed  and function arglist or 1-line variable documentation will be displayed
89  even if echo area must be resized to fit.  even if echo area must be resized to fit.
90    
91  If value is any non-nil value other than `t', symbol name may be truncated  If value is any non-nil value other than t, symbol name may be truncated
92  if it will enable the function arglist or documentation string to fit on a  if it will enable the function arglist or documentation string to fit on a
93  single line without resizing window.  Otherwise, behavior is just like  single line without resizing window.  Otherwise, behavior is just like
94  former case.  former case.
# Line 180  With prefix ARG, turn ElDoc mode on if a Line 183  With prefix ARG, turn ElDoc mode on if a
183    
184  (defun eldoc-message (&rest args)  (defun eldoc-message (&rest args)
185    (let ((omessage eldoc-last-message))    (let ((omessage eldoc-last-message))
186      (setq eldoc-last-message      (setq eldoc-last-message
187            (cond ((eq (car args) eldoc-last-message) eldoc-last-message)            (cond ((eq (car args) eldoc-last-message) eldoc-last-message)
188                  ((null (car args)) nil)                  ((null (car args)) nil)
189                  ;; If only one arg, no formatting to do, so put it in                  ;; If only one arg, no formatting to do, so put it in
# Line 233  With prefix ARG, turn ElDoc mode on if a Line 236  With prefix ARG, turn ElDoc mode on if a
236         (not (eq (selected-window) (minibuffer-window)))))         (not (eq (selected-window) (minibuffer-window)))))
237    
238    
239    (defvar eldoc-print-current-symbol-info-function nil
240      "If non-nil, function to call to return doc string.
241    The function of no args should return a one-line string for displaying
242    doc about a function etc. appropriate to the context around point.
243    It should return nil if there's no doc appropriate for the context.
244    Typically doc is returned if point is on a function-like name or in its
245    arg list.
246    
247    This variable is expected to be made buffer-local by modes (other than
248    Emacs Lisp mode) that support Eldoc.")
249    
250  (defun eldoc-print-current-symbol-info ()  (defun eldoc-print-current-symbol-info ()
251    (condition-case err    (condition-case err
252        (and (eldoc-display-message-p)        (and (eldoc-display-message-p)
253             (let* ((current-symbol (eldoc-current-symbol))             (if eldoc-print-current-symbol-info-function
254                    (current-fnsym  (eldoc-fnsym-in-current-sexp))                 (eldoc-message (funcall eldoc-print-current-symbol-info-function))
255                    (doc (cond               (let* ((current-symbol (eldoc-current-symbol))
256                          ((eq current-symbol current-fnsym)                      (current-fnsym  (eldoc-fnsym-in-current-sexp))
257                           (or (eldoc-get-fnsym-args-string current-fnsym)                      (doc (cond
258                               (eldoc-get-var-docstring current-symbol)))                            ((eq current-symbol current-fnsym)
259                          (t                             (or (eldoc-get-fnsym-args-string current-fnsym)
260                           (or (eldoc-get-var-docstring current-symbol)                                 (eldoc-get-var-docstring current-symbol)))
261                               (eldoc-get-fnsym-args-string current-fnsym))))))                            (t
262               (eldoc-message doc)))                             (or (eldoc-get-var-docstring current-symbol)
263                                   (eldoc-get-fnsym-args-string current-fnsym))))))
264                   (eldoc-message doc))))
265      ;; This is run from post-command-hook or some idle timer thing,      ;; This is run from post-command-hook or some idle timer thing,
266      ;; so we need to be careful that errors aren't ignored.      ;; so we need to be careful that errors aren't ignored.
267      (error (message "eldoc error: %s" err))))      (error (message "eldoc error: %s" err))))
# Line 451  With prefix ARG, turn ElDoc mode on if a Line 467  With prefix ARG, turn ElDoc mode on if a
467    
468  (provide 'eldoc)  (provide 'eldoc)
469    
470    ;;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375
471  ;;; eldoc.el ends here  ;;; eldoc.el ends here

Legend:
Removed from v.1.20.4.1  
changed lines
  Added in v.1.20.4.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26