aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Friedman1997-02-04 18:21:29 +0000
committerNoah Friedman1997-02-04 18:21:29 +0000
commit4fa073648dc73d11bc0fe8501e1d5e510d8cd7a8 (patch)
treeb6842b183ee0bb074a4add4f4a3d9aff56a44eff
parent008d825ad346e2c8c5750c6bf0d9fa20ae911e5e (diff)
downloademacs-4fa073648dc73d11bc0fe8501e1d5e510d8cd7a8.tar.gz
emacs-4fa073648dc73d11bc0fe8501e1d5e510d8cd7a8.zip
(eldoc-display-message-p): New function.
Return nil if cursor-in-echo-area, or using idle timers and a command is still active. (eldoc-print-current-symbol-info): Use eldoc-display-message-p.
-rw-r--r--lisp/emacs-lisp/eldoc.el36
1 files changed, 23 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 5123fd7b81b..dfb983e771f 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -7,7 +7,7 @@
7;; Keywords: extensions 7;; Keywords: extensions
8;; Created: 1995-10-06 8;; Created: 1995-10-06
9 9
10;; $Id: eldoc.el,v 1.7 1996/10/04 04:43:42 friedman Exp $ 10;; $Id: eldoc.el,v 1.8 1997/02/03 06:13:34 friedman Exp $
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -43,6 +43,7 @@
43;; (autoload 'turn-on-eldoc-mode "eldoc" nil t) 43;; (autoload 'turn-on-eldoc-mode "eldoc" nil t)
44;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) 44;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
45;; (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) 45;; (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
46;; (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
46 47
47;;; Code: 48;;; Code:
48 49
@@ -234,15 +235,32 @@ overwrite them unless it is more restrained."
234 235
235 236
236(defun eldoc-print-current-symbol-info () 237(defun eldoc-print-current-symbol-info ()
238 (and (eldoc-display-message-p)
239 (let ((current-symbol (eldoc-current-symbol))
240 (current-fnsym (eldoc-fnsym-in-current-sexp)))
241 (cond ((eq current-symbol current-fnsym)
242 (eldoc-print-fnsym-args current-fnsym))
243 (t
244 (or (eldoc-print-var-docstring current-symbol)
245 (eldoc-print-fnsym-args current-fnsym)))))))
246
247;; Decide whether now is a good time to display a message.
248(defun eldoc-display-message-p ()
237 (and eldoc-mode 249 (and eldoc-mode
238 (not executing-kbd-macro) 250 (not executing-kbd-macro)
239 251
240 ;; Having this mode operate in an active minibuffer makes it 252 ;; Having this mode operate in an active minibuffer/echo area causes
241 ;; impossible to what you're doing. 253 ;; interference with what's going on there.
254 (not cursor-in-echo-area)
242 (not (eq (selected-window) (minibuffer-window))) 255 (not (eq (selected-window) (minibuffer-window)))
243 256
244 (cond (eldoc-use-idle-timer-p 257 (cond (eldoc-use-idle-timer-p
245 (and (symbolp last-command) 258 ;; If this-command is non-nil while running via an idle
259 ;; timer, we're still in the middle of executing a command,
260 ;; e.g. a query-replace where it would be annoying to
261 ;; overwrite the echo area.
262 (and (not this-command)
263 (symbolp last-command)
246 (intern-soft (symbol-name last-command) 264 (intern-soft (symbol-name last-command)
247 eldoc-message-commands))) 265 eldoc-message-commands)))
248 (t 266 (t
@@ -253,15 +271,7 @@ overwrite them unless it is more restrained."
253 (and (symbolp this-command) 271 (and (symbolp this-command)
254 (intern-soft (symbol-name this-command) 272 (intern-soft (symbol-name this-command)
255 eldoc-message-commands) 273 eldoc-message-commands)
256 (sit-for eldoc-idle-delay)))) 274 (sit-for eldoc-idle-delay))))))
257
258 (let ((current-symbol (eldoc-current-symbol))
259 (current-fnsym (eldoc-fnsym-in-current-sexp)))
260 (cond ((eq current-symbol current-fnsym)
261 (eldoc-print-fnsym-args current-fnsym))
262 (t
263 (or (eldoc-print-var-docstring current-symbol)
264 (eldoc-print-fnsym-args current-fnsym)))))))
265 275
266(defun eldoc-print-fnsym-args (&optional symbol) 276(defun eldoc-print-fnsym-args (&optional symbol)
267 (interactive) 277 (interactive)