diff options
| author | Leo Liu | 2013-03-18 17:16:15 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-03-18 17:16:15 +0800 |
| commit | 33cef733e0a196262f3c32c61e2157fa0d41f2e6 (patch) | |
| tree | b9218d05ce9771905ad4f10cf7ec4564d6bb7f1d | |
| parent | 2167b7b28faf65ff2c669b6a00734a22eaf12612 (diff) | |
| download | emacs-33cef733e0a196262f3c32c61e2157fa0d41f2e6.tar.gz emacs-33cef733e0a196262f3c32c61e2157fa0d41f2e6.zip | |
Make sure eldoc can be turned off properly.
* emacs-lisp/eldoc.el (eldoc-schedule-timer): Conditionalize on
eldoc-mode.
(eldoc-display-message-p): Revert last change.
(eldoc-display-message-no-interference-p)
(eldoc-print-current-symbol-info): Tweak.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eldoc.el | 27 |
2 files changed, 22 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 082054e5be5..7bd027a81d4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2013-03-18 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | Make sure eldoc can be turned off properly. | ||
| 4 | * emacs-lisp/eldoc.el (eldoc-schedule-timer): Conditionalize on | ||
| 5 | eldoc-mode. | ||
| 6 | (eldoc-display-message-p): Revert last change. | ||
| 7 | (eldoc-display-message-no-interference-p) | ||
| 8 | (eldoc-print-current-symbol-info): Tweak. | ||
| 9 | |||
| 1 | 2013-03-18 Tassilo Horn <tsdh@gnu.org> | 10 | 2013-03-18 Tassilo Horn <tsdh@gnu.org> |
| 2 | 11 | ||
| 3 | * doc-view.el (doc-view-new-window-function): Check the new window | 12 | * doc-view.el (doc-view-new-window-function): Check the new window |
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index d2730a28eaa..4efbdcb22cb 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -198,8 +198,9 @@ expression point is on." | |||
| 198 | (or (and eldoc-timer | 198 | (or (and eldoc-timer |
| 199 | (memq eldoc-timer timer-idle-list)) | 199 | (memq eldoc-timer timer-idle-list)) |
| 200 | (setq eldoc-timer | 200 | (setq eldoc-timer |
| 201 | (run-with-idle-timer eldoc-idle-delay t | 201 | (run-with-idle-timer |
| 202 | 'eldoc-print-current-symbol-info))) | 202 | eldoc-idle-delay t |
| 203 | (lambda () (and eldoc-mode (eldoc-print-current-symbol-info)))))) | ||
| 203 | 204 | ||
| 204 | ;; If user has changed the idle delay, update the timer. | 205 | ;; If user has changed the idle delay, update the timer. |
| 205 | (cond ((not (= eldoc-idle-delay eldoc-current-idle-delay)) | 206 | (cond ((not (= eldoc-idle-delay eldoc-current-idle-delay)) |
| @@ -272,21 +273,19 @@ Otherwise work like `message'." | |||
| 272 | ;; Decide whether now is a good time to display a message. | 273 | ;; Decide whether now is a good time to display a message. |
| 273 | (defun eldoc-display-message-p () | 274 | (defun eldoc-display-message-p () |
| 274 | (and (eldoc-display-message-no-interference-p) | 275 | (and (eldoc-display-message-no-interference-p) |
| 275 | ;; `eldoc-post-insert-mode' uses no timers. | 276 | ;; If this-command is non-nil while running via an idle |
| 276 | (or (not eldoc-mode) | 277 | ;; timer, we're still in the middle of executing a command, |
| 277 | ;; If this-command is non-nil while running via an idle | 278 | ;; e.g. a query-replace where it would be annoying to |
| 278 | ;; timer, we're still in the middle of executing a command, | 279 | ;; overwrite the echo area. |
| 279 | ;; e.g. a query-replace where it would be annoying to | 280 | (and (not this-command) |
| 280 | ;; overwrite the echo area. | 281 | (symbolp last-command) |
| 281 | (and (not this-command) | 282 | (intern-soft (symbol-name last-command) |
| 282 | (symbolp last-command) | 283 | eldoc-message-commands)))) |
| 283 | (intern-soft (symbol-name last-command) | ||
| 284 | eldoc-message-commands))))) | ||
| 285 | 284 | ||
| 286 | ;; Check various conditions about the current environment that might make | 285 | ;; Check various conditions about the current environment that might make |
| 287 | ;; it undesirable to print eldoc messages right this instant. | 286 | ;; it undesirable to print eldoc messages right this instant. |
| 288 | (defun eldoc-display-message-no-interference-p () | 287 | (defun eldoc-display-message-no-interference-p () |
| 289 | (and (or eldoc-mode eldoc-post-insert-mode) | 288 | (and eldoc-mode |
| 290 | (not executing-kbd-macro) | 289 | (not executing-kbd-macro) |
| 291 | (not (and (boundp 'edebug-active) edebug-active)))) | 290 | (not (and (boundp 'edebug-active) edebug-active)))) |
| 292 | 291 | ||
| @@ -310,7 +309,7 @@ Emacs Lisp mode) that support ElDoc.") | |||
| 310 | 309 | ||
| 311 | (defun eldoc-print-current-symbol-info () | 310 | (defun eldoc-print-current-symbol-info () |
| 312 | (condition-case err | 311 | (condition-case err |
| 313 | (and (eldoc-display-message-p) | 312 | (and (or (eldoc-display-message-p) eldoc-post-insert-mode) |
| 314 | (if eldoc-documentation-function | 313 | (if eldoc-documentation-function |
| 315 | (eldoc-message (funcall eldoc-documentation-function)) | 314 | (eldoc-message (funcall eldoc-documentation-function)) |
| 316 | (let* ((current-symbol (eldoc-current-symbol)) | 315 | (let* ((current-symbol (eldoc-current-symbol)) |