emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/eldoc.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/eldoc.el [lexbind]
Date: Tue, 14 Oct 2003 19:32:25 -0400

Index: emacs/lisp/emacs-lisp/eldoc.el
diff -c emacs/lisp/emacs-lisp/eldoc.el:1.20.4.1 
emacs/lisp/emacs-lisp/eldoc.el:1.20.4.2
*** emacs/lisp/emacs-lisp/eldoc.el:1.20.4.1     Fri Apr  4 01:20:16 2003
--- emacs/lisp/emacs-lisp/eldoc.el      Tue Oct 14 19:32:21 2003
***************
*** 7,13 ****
  ;; Keywords: extensions
  ;; Created: 1995-10-06
  
! ;; $Id: eldoc.el,v 1.20.4.1 2003/04/04 06:20:16 miles Exp $
  
  ;; This file is part of GNU Emacs.
  
--- 7,13 ----
  ;; Keywords: extensions
  ;; Created: 1995-10-06
  
! ;; $Id: eldoc.el,v 1.20.4.2 2003/10/14 23:32:21 miles Exp $
  
  ;; This file is part of GNU Emacs.
  
***************
*** 40,50 ****
  ;; 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)
  
  ;;; Code:
  
  (require 'help-fns)                  ;For fundoc-usage handling functions.
--- 40,53 ----
  ;; One useful way to enable this minor mode is to put the following in your
  ;; .emacs:
  ;;
  ;;      (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.
***************
*** 81,91 ****
  
  (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
    "*Allow long eldoc messages to resize echo area display.
! If value is `t', never attempt to truncate messages; complete symbol name
  and function arglist or 1-line variable documentation will be displayed
  even if echo area must be resized to fit.
  
! If value is any non-nil value other than `t', symbol name may be truncated
  if it will enable the function arglist or documentation string to fit on a
  single line without resizing window.  Otherwise, behavior is just like
  former case.
--- 84,94 ----
  
  (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
    "*Allow long eldoc messages to resize echo area display.
! If value is t, never attempt to truncate messages; complete symbol name
  and function arglist or 1-line variable documentation will be displayed
  even if echo area must be resized to fit.
  
! If value is any non-nil value other than t, symbol name may be truncated
  if it will enable the function arglist or documentation string to fit on a
  single line without resizing window.  Otherwise, behavior is just like
  former case.
***************
*** 180,186 ****
  
  (defun eldoc-message (&rest args)
    (let ((omessage eldoc-last-message))
!     (setq eldoc-last-message 
          (cond ((eq (car args) eldoc-last-message) eldoc-last-message)
                ((null (car args)) nil)
                ;; If only one arg, no formatting to do, so put it in
--- 183,189 ----
  
  (defun eldoc-message (&rest args)
    (let ((omessage eldoc-last-message))
!     (setq eldoc-last-message
          (cond ((eq (car args) eldoc-last-message) eldoc-last-message)
                ((null (car args)) nil)
                ;; If only one arg, no formatting to do, so put it in
***************
*** 233,251 ****
         (not (eq (selected-window) (minibuffer-window)))))
  
  
  (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)))
      ;; 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))))
--- 236,267 ----
         (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)
!          (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,454 ****
--- 467,471 ----
  
  (provide 'eldoc)
  
+ ;;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375
  ;;; eldoc.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]