emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[ELPA-diffs] elpa r437: (eldoc-display-message-no-interference-p): Turn


From: Stefan Monnier
Subject: [ELPA-diffs] elpa r437: (eldoc-display-message-no-interference-p): Turn it into an advice.
Date: Tue, 13 Aug 2013 14:15:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 437
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: elpa
timestamp: Tue 2013-08-13 10:16:01 -0400
message:
  (eldoc-display-message-no-interference-p): Turn it into an advice.
  (eldoc-active-minibuffers-list): Store buffers rather than buffer names.
modified:
  packages/eldoc-eval/eldoc-eval.el 
eldoceval.el-20110925210758-7hzdscr3i29577xr-2
=== modified file 'packages/eldoc-eval/eldoc-eval.el'
--- a/packages/eldoc-eval/eldoc-eval.el 2013-08-13 13:59:47 +0000
+++ b/packages/eldoc-eval/eldoc-eval.el 2013-08-13 14:16:01 +0000
@@ -1,6 +1,6 @@
 ;;; eldoc-eval.el --- Enable eldoc support when minibuffer is in use.
 
-;; Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
 
 ;; Author: Thierry Volpiatto <address@hidden>
 ;; Version: 0.1
@@ -45,6 +45,12 @@
 ;;; Code:
 (require 'eldoc)
 
+;; FIXME: This has no autoloads and (require 'eldoc-eval) will change Emacs's
+;; behavior, against usual conventions.  The fix is to define
+;; eldoc-in-minibuffer as a (global) minor mode, then autoload it.  So the
+;; default value will be nil, and the user can enable it with
+;; (eldoc-in-minibuffer 1) or by customizing eldoc-in-minibuffer, rather than
+;; by adding (require 'eldoc-eval) in her .emacs.
 
 ;;; Minibuffer support.
 ;;  Enable displaying eldoc info in something else
@@ -84,14 +90,17 @@
 (when (boundp 'eldoc-message-function)
   (setq eldoc-message-function 'message)
 
-  (defun eldoc-display-message-no-interference-p ()
-    (and eldoc-mode
-         (not executing-kbd-macro)
-         (not (and (boundp 'edebug-active) edebug-active))
-         ;; Having this mode operate in an active minibuffer/echo area causes
-         ;; interference with what's going on there.
-         (not cursor-in-echo-area)
-         (not (eq (selected-window) (minibuffer-window))))))
+  (defadvice eldoc-display-message-no-interference-p
+      (around eldoc-eval activate)
+    (if (not eldoc-in-minibuffer)
+        ad-do-it
+      (and eldoc-mode
+           (not executing-kbd-macro)
+           (not (and (boundp 'edebug-active) edebug-active))
+           ;; Having this mode operate in an active minibuffer/echo area causes
+           ;; interference with what's going on there.
+           (not cursor-in-echo-area)
+           (not (eq (selected-window) (minibuffer-window)))))))
 
 ;; Internal.
 (defvar eldoc-active-minibuffers-list nil
@@ -103,7 +112,7 @@
 This function is called by each minibuffer started with eldoc support.
 See `with-eldoc-in-minibuffer'."
   (with-selected-window (minibuffer-window)
-    (push (buffer-name) eldoc-active-minibuffers-list)))
+    (push (current-buffer) eldoc-active-minibuffers-list)))
 
 (defmacro with-eldoc-in-minibuffer (&rest body)
   "Enable eldoc support for minibuffer input that runs in BODY."
@@ -166,7 +175,7 @@
 
 (defun eldoc-mode-in-minibuffer ()
   "Show eldoc for current minibuffer input."
-  (let ((buf (buffer-name (window-buffer (active-minibuffer-window)))))
+  (let ((buf (window-buffer (active-minibuffer-window))))
     ;; If this minibuffer have been started with
     ;;`with-eldoc-in-minibuffer' give it eldoc support
     ;; and update mode-line, otherwise do nothing.
@@ -193,6 +202,9 @@
     (call-interactively eval-preferred-function)))
 
 ;; Bind it to `M-:'.
+
+;; FIXME: Turn eldoc-in-minibuffer into a global minor mode, and place this
+;; binding in its keymap.
 (global-set-key [remap eval-expression] 'eval-expression-with-eldoc)
 
 


reply via email to

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