GNU bug report logs - #13978
24.3; New minor mode eldoc-post-insert-mode

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Sat, 16 Mar 2013 19:26:01 UTC

Severity: normal

Found in version 24.3

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13978 in the body.
You can then email your comments to 13978 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sat, 16 Mar 2013 19:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Sat, 16 Mar 2013 19:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 03:23:49 +0800
[Message part 1 (text/plain, inline)]
The attached patch adds a new minor mode eldoc-post-insert-mode to
eldoc.el; the new mode can also be used by eval-expression (screenshot
attached). The feature supersedes eldoc-eval in GNU ELPA.

See discussion: http://article.gmane.org/gmane.emacs.devel/144524

[eldoc-post-insert-mode.png (image/png, attachment)]
[eldoc-post-insert-mode.diff (text/x-patch, inline)]
From e3aff878ebed7e4f5b67f539b9caaf5a0309a9c3 Mon Sep 17 00:00:00 2001
From: Leo Liu <sdl.web <at> gmail.com>
Date: Sun, 17 Mar 2013 02:44:58 +0800
Subject: [PATCH 1/3] New variable eval-expression-minibuffer-hook

---
 lisp/simple.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 526cc64c..0c366db3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1235,6 +1235,9 @@ (defun eval-expression-print-format (value)
             (format " (#o%o, #x%x, %s)" value value char-string)
           (format " (#o%o, #x%x)" value value)))))
 
+(defvar eval-expression-minibuffer-hook nil
+  "Hook run by `eval-expression' when entering the minibuffer.")
+
 ;; We define this, rather than making `eval' interactive,
 ;; for the sake of completion of names like eval-region, eval-buffer.
 (defun eval-expression (eval-expression-arg
@@ -1253,9 +1256,11 @@ (defun eval-expression (eval-expression-arg
 this command arranges for all errors to enter the debugger."
   (interactive
    (list (let ((minibuffer-completing-symbol t))
-	   (read-from-minibuffer "Eval: "
-				 nil read-expression-map t
-				 'read-expression-history))
+	   (minibuffer-with-setup-hook
+	       (lambda () (run-hooks 'eval-expression-minibuffer-hook))
+	     (read-from-minibuffer "Eval: "
+				   nil read-expression-map t
+				   'read-expression-history)))
 	 current-prefix-arg))
 
   (if (null eval-expression-debug-on-error)
-- 
1.8.2


From d816ede71aa79999cfbaa3951b1d378b4cde361c Mon Sep 17 00:00:00 2001
From: Leo <sdl.web <at> gmail.com>
Date: Wed, 5 Oct 2011 17:33:58 +0800
Subject: [PATCH 2/3] Allow eldoc to post messages to the mode-line

---
 lisp/emacs-lisp/eldoc.el | 43 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 0f018573..8bce26c0 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -146,6 +146,11 @@ (defvar eldoc-current-idle-delay eldoc-idle-delay
   "Idle time delay currently in use by timer.
 This is used to determine if `eldoc-idle-delay' is changed by the user.")
 
+(defvar eldoc-message-function nil
+  "The function used by `eldoc-message' to display messages.
+It should receive the same arguments as `message'. If this is
+nil, `eldoc-minibuffer-message' is used.")
+
 
 ;;;###autoload
 (define-minor-mode eldoc-mode
@@ -188,8 +193,40 @@ (defun eldoc-schedule-timer ()
          (setq eldoc-current-idle-delay eldoc-idle-delay)
          (timer-set-idle-time eldoc-timer eldoc-idle-delay t))))
 
+(defvar eldoc-mode-line-string nil)
+(put 'eldoc-mode-line-string 'risky-local-variable t)
+
+(defun eldoc-minibuffer-message (format-string &rest args)
+  "Show messages in the mode-line when in the minibuffer.
+Otherwise, behave like function `message'."
+  (if (minibufferp)
+      (progn
+	(with-current-buffer
+	    (window-buffer
+	     (or (window-in-direction 'above (minibuffer-window))
+		 (minibuffer-selected-window)
+		 (get-largest-window)))
+	  (unless (and (listp mode-line-format)
+		       (assq 'eldoc-mode-line-string mode-line-format))
+	    (setq mode-line-format
+		  (list "" '(eldoc-mode-line-string
+			     (" " eldoc-mode-line-string " "))
+			mode-line-format))))
+	(add-hook 'minibuffer-exit-hook
+		  (lambda () (setq eldoc-mode-line-string nil))
+		  nil t)
+	(cond
+	 ((null format-string)
+	  (setq eldoc-mode-line-string nil))
+	 ((stringp format-string)
+	  (setq eldoc-mode-line-string
+		(apply 'format format-string args))))
+	(force-mode-line-update))
+    (apply 'message format-string args)))
+
 (defun eldoc-message (&rest args)
-  (let ((omessage eldoc-last-message))
+  (let ((omessage eldoc-last-message)
+        (msgfunc (or eldoc-message-function #'eldoc-minibuffer-message)))
     (setq eldoc-last-message
 	  (cond ((eq (car args) eldoc-last-message) eldoc-last-message)
 		((null (car args)) nil)
@@ -203,8 +240,8 @@ (defun eldoc-message (&rest args)
     ;; they are Legion.
     ;; Emacs way of preventing log messages.
     (let ((message-log-max nil))
-      (cond (eldoc-last-message (message "%s" eldoc-last-message))
-	    (omessage (message nil)))))
+      (cond (eldoc-last-message (funcall msgfunc "%s" eldoc-last-message))
+	    (omessage (funcall msgfunc nil)))))
   eldoc-last-message)
 
 ;; This function goes on pre-command-hook for XEmacs or when using idle
-- 
1.8.2


From e0bbc2b6ea1745f8383a7ad8313031c5b6e3dc1e Mon Sep 17 00:00:00 2001
From: Leo Liu <sdl.web <at> gmail.com>
Date: Sun, 17 Mar 2013 03:03:11 +0800
Subject: [PATCH 3/3] Implement eldoc-post-insert-mode

---
 lisp/emacs-lisp/eldoc.el | 50 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 8bce26c0..2f3e1644 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -174,6 +174,18 @@ (define-minor-mode eldoc-mode
    (remove-hook 'post-command-hook 'eldoc-schedule-timer)
    (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area)))
 
+(define-minor-mode eldoc-post-insert-mode nil
+  :group 'eldoc :lighter ""
+  (setq eldoc-last-message nil)
+  (let ((prn-info (lambda ()
+		    (unless eldoc-mode
+		      (eldoc-print-current-symbol-info-1)))))
+    (if eldoc-post-insert-mode
+	(add-hook 'post-self-insert-hook prn-info nil t)
+      (remove-hook 'post-self-insert-hook prn-info t))))
+
+(add-hook 'eval-expression-minibuffer-hook 'eldoc-post-insert-mode)
+
 ;;;###autoload
 (defun turn-on-eldoc-mode ()
   "Unequivocally turn on ElDoc mode (see command `eldoc-mode')."
@@ -297,29 +309,31 @@ (defvar eldoc-documentation-function nil
 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 ()
+(defun eldoc-print-current-symbol-info-1 ()
   (condition-case err
-      (and (eldoc-display-message-p)
-	   (if eldoc-documentation-function
-	       (eldoc-message (funcall eldoc-documentation-function))
-	     (let* ((current-symbol (eldoc-current-symbol))
-		    (current-fnsym  (eldoc-fnsym-in-current-sexp))
-		    (doc (cond
-			  ((null current-fnsym)
-			   nil)
-			  ((eq current-symbol (car current-fnsym))
-			   (or (apply 'eldoc-get-fnsym-args-string
-				      current-fnsym)
-			       (eldoc-get-var-docstring current-symbol)))
-			  (t
-			   (or (eldoc-get-var-docstring current-symbol)
-			       (apply 'eldoc-get-fnsym-args-string
-				      current-fnsym))))))
-	       (eldoc-message doc))))
+      (if eldoc-documentation-function
+	  (eldoc-message (funcall eldoc-documentation-function))
+	(let* ((current-symbol (eldoc-current-symbol))
+	       (current-fnsym  (eldoc-fnsym-in-current-sexp))
+	       (doc (cond
+		     ((null current-fnsym)
+		      nil)
+		     ((eq current-symbol (car current-fnsym))
+		      (or (apply 'eldoc-get-fnsym-args-string
+				 current-fnsym)
+			  (eldoc-get-var-docstring current-symbol)))
+		     (t
+		      (or (eldoc-get-var-docstring current-symbol)
+			  (apply '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))))
 
+(defun eldoc-print-current-symbol-info ()
+  (and (eldoc-display-message-p) (eldoc-print-current-symbol-info-1)))
+
 (defun eldoc-get-fnsym-args-string (sym &optional index)
   "Return a string containing the parameter list of the function SYM.
 If SYM is a subr and no arglist is obtainable from the docstring
-- 
1.8.2


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sat, 16 Mar 2013 21:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sat, 16 Mar 2013 17:55:21 -0400
> The attached patch adds a new minor mode eldoc-post-insert-mode to
> eldoc.el; the new mode can also be used by eval-expression (screenshot
> attached). The feature supersedes eldoc-eval in GNU ELPA.

It's looking fairly good.  Questions and comments inline below.

> +(defvar eval-expression-minibuffer-hook nil
> +  "Hook run by `eval-expression' when entering the minibuffer.")

I'd call it eval-expression-minibuffer-setup-hook or maybe I'd just call
an emacs-lisp-minibuffer-mode (which might need to not be an actual
major-mode for technical reasons, but could try to be close to one).

I'd like to move towards using major modes in the minibuffer, so we
might as well plan for that future.

> +(defvar eldoc-message-function nil
> +  "The function used by `eldoc-message' to display messages.
> +It should receive the same arguments as `message'. If this is
> +nil, `eldoc-minibuffer-message' is used.")

Please give it `eldoc-minibuffer-message' as default value rather
than nil.  Better yet give it `message' as default value and set it to
a different value for in-minibuffer use.

> +(define-minor-mode eldoc-post-insert-mode nil
> +  :group 'eldoc :lighter ""
> +  (setq eldoc-last-message nil)
> +  (let ((prn-info (lambda ()
> +		    (unless eldoc-mode
> +		      (eldoc-print-current-symbol-info-1)))))
> +    (if eldoc-post-insert-mode
> +	(add-hook 'post-self-insert-hook prn-info nil t)
> +      (remove-hook 'post-self-insert-hook prn-info t))))

Shouldn't that be called `eldoc-minibuffer-mode'?
And why not just use eldoc-mode?

> -(defun eldoc-print-current-symbol-info ()
> +(defun eldoc-print-current-symbol-info-1 ()
[...] 
> +(defun eldoc-print-current-symbol-info ()
> +  (and (eldoc-display-message-p) (eldoc-print-current-symbol-info-1)))

I removed (not (eq (selected-window) (minibuffer-window)) and (not
cursor-in-echo-area) from my eldoc-display-message-no-interference-p
and haven't noticed any downside, so maybe we can just do that and avoid
creating eldoc-print-current-symbol-info-1 and eldoc-minibuffer-mode.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 02:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13978 <at> debbugs.gnu.org
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 10:56:25 +0800
[Message part 1 (text/plain, inline)]
On 2013-03-17 05:55 +0800, Stefan Monnier wrote:
> It's looking fairly good.  Questions and comments inline below.

Thanks for the time.

> I'd call it eval-expression-minibuffer-setup-hook or maybe I'd just call
> an emacs-lisp-minibuffer-mode (which might need to not be an actual
> major-mode for technical reasons, but could try to be close to one).
>
> I'd like to move towards using major modes in the minibuffer, so we
> might as well plan for that future.

I renamed it to eval-expression-minibuffer-setup-hook for now. The major
mode is a nice idea which I'll find another time to do it. I want the
font-locking to work as well. For the moment font-lock-mode ignores all
invisible buffers.

> Please give it `eldoc-minibuffer-message' as default value rather
> than nil.  Better yet give it `message' as default value and set it to
> a different value for in-minibuffer use.

Done!

> Shouldn't that be called `eldoc-minibuffer-mode'?
> And why not just use eldoc-mode?

eldoc-post-insert-mode can work everywhere not just in the minibuffer.
The idea is from me finding eldoc-mode too distracting by printing
'constantly' to the echo area. Thus eldoc-post-insert-mode only shows
the info when you are typing. (For me it shows the info at the moment I
need it ;)).

> I removed (not (eq (selected-window) (minibuffer-window)) and (not
> cursor-in-echo-area) from my eldoc-display-message-no-interference-p
> and haven't noticed any downside, so maybe we can just do that and avoid
> creating eldoc-print-current-symbol-info-1 and eldoc-minibuffer-mode.

Done.

>         Stefan

Leo

[0001-Implement-eldoc-post-insert-mode.patch (text/x-patch, inline)]
From 4e4335d3cd3ee8f5e5f9d426e399f39b0aff05c5 Mon Sep 17 00:00:00 2001
From: Leo Liu <sdl.web <at> gmail.com>
Date: Sun, 17 Mar 2013 10:44:21 +0800
Subject: [PATCH] Implement eldoc-post-insert-mode

http://debbugs.gnu.org/13978
---
 lisp/emacs-lisp/eldoc.el | 79 ++++++++++++++++++++++++++++++++++++++----------
 lisp/simple.el           | 11 +++++--
 2 files changed, 71 insertions(+), 19 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 0f018573..0b78530c 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -146,6 +146,10 @@ (defvar eldoc-current-idle-delay eldoc-idle-delay
   "Idle time delay currently in use by timer.
 This is used to determine if `eldoc-idle-delay' is changed by the user.")
 
+(defvar eldoc-message-function 'eldoc-minibuffer-message
+  "The function used by `eldoc-message' to display messages.
+It should receive the same arguments as `message'.")
+
 
 ;;;###autoload
 (define-minor-mode eldoc-mode
@@ -169,6 +173,19 @@ (define-minor-mode eldoc-mode
    (remove-hook 'post-command-hook 'eldoc-schedule-timer)
    (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area)))
 
+(define-minor-mode eldoc-post-insert-mode nil
+  :group 'eldoc :lighter (:eval (if eldoc-mode ""
+				  (concat eldoc-minor-mode-string "|i")))
+  (setq eldoc-last-message nil)
+  (let ((prn-info (lambda ()
+		    (unless eldoc-mode
+		      (eldoc-print-current-symbol-info)))))
+    (if eldoc-post-insert-mode
+	(add-hook 'post-self-insert-hook prn-info nil t)
+      (remove-hook 'post-self-insert-hook prn-info t))))
+
+(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-post-insert-mode)
+
 ;;;###autoload
 (defun turn-on-eldoc-mode ()
   "Unequivocally turn on ElDoc mode (see command `eldoc-mode')."
@@ -188,6 +205,37 @@ (defun eldoc-schedule-timer ()
          (setq eldoc-current-idle-delay eldoc-idle-delay)
          (timer-set-idle-time eldoc-timer eldoc-idle-delay t))))
 
+(defvar eldoc-mode-line-string nil)
+(put 'eldoc-mode-line-string 'risky-local-variable t)
+
+(defun eldoc-minibuffer-message (format-string &rest args)
+  "Display messages in the mode-line when in the minibuffer.
+Otherwise work like `message'."
+  (if (minibufferp)
+      (progn
+	(with-current-buffer
+	    (window-buffer
+	     (or (window-in-direction 'above (minibuffer-window))
+		 (minibuffer-selected-window)
+		 (get-largest-window)))
+	  (unless (and (listp mode-line-format)
+		       (assq 'eldoc-mode-line-string mode-line-format))
+	    (setq mode-line-format
+		  (list "" '(eldoc-mode-line-string
+			     (" " eldoc-mode-line-string " "))
+			mode-line-format))))
+	(add-hook 'minibuffer-exit-hook
+		  (lambda () (setq eldoc-mode-line-string nil))
+		  nil t)
+	(cond
+	 ((null format-string)
+	  (setq eldoc-mode-line-string nil))
+	 ((stringp format-string)
+	  (setq eldoc-mode-line-string
+		(apply 'format format-string args))))
+	(force-mode-line-update))
+    (apply 'message format-string args)))
+
 (defun eldoc-message (&rest args)
   (let ((omessage eldoc-last-message))
     (setq eldoc-last-message
@@ -203,8 +251,9 @@ (defun eldoc-message (&rest args)
     ;; they are Legion.
     ;; Emacs way of preventing log messages.
     (let ((message-log-max nil))
-      (cond (eldoc-last-message (message "%s" eldoc-last-message))
-	    (omessage (message nil)))))
+      (cond (eldoc-last-message
+	     (funcall eldoc-message-function "%s" eldoc-last-message))
+	    (omessage (funcall eldoc-message-function nil)))))
   eldoc-last-message)
 
 ;; This function goes on pre-command-hook for XEmacs or when using idle
@@ -222,25 +271,23 @@ (defun eldoc-pre-command-refresh-echo-area ()
 ;; Decide whether now is a good time to display a message.
 (defun eldoc-display-message-p ()
   (and (eldoc-display-message-no-interference-p)
-       ;; If this-command is non-nil while running via an idle
-       ;; timer, we're still in the middle of executing a command,
-       ;; e.g. a query-replace where it would be annoying to
-       ;; overwrite the echo area.
-       (and (not this-command)
-	    (symbolp last-command)
-	    (intern-soft (symbol-name last-command)
-			 eldoc-message-commands))))
+       ;; `eldoc-post-insert-mode' use no timers.
+       (or (not eldoc-mode)
+	   ;; If this-command is non-nil while running via an idle
+	   ;; timer, we're still in the middle of executing a command,
+	   ;; e.g. a query-replace where it would be annoying to
+	   ;; overwrite the echo area.
+	   (and (not this-command)
+		(symbolp last-command)
+		(intern-soft (symbol-name last-command)
+			     eldoc-message-commands)))))
 
 ;; Check various conditions about the current environment that might make
 ;; it undesirable to print eldoc messages right this instant.
 (defun eldoc-display-message-no-interference-p ()
-  (and eldoc-mode
+  (and (or eldoc-mode eldoc-post-insert-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)))))
+       (not (and (boundp 'edebug-active) edebug-active))))
 
 
 ;;;###autoload
diff --git a/lisp/simple.el b/lisp/simple.el
index 526cc64c..42253645 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1235,6 +1235,9 @@ (defun eval-expression-print-format (value)
             (format " (#o%o, #x%x, %s)" value value char-string)
           (format " (#o%o, #x%x)" value value)))))
 
+(defvar eval-expression-minibuffer-setup-hook nil
+  "Hook run by `eval-expression' when entering the minibuffer.")
+
 ;; We define this, rather than making `eval' interactive,
 ;; for the sake of completion of names like eval-region, eval-buffer.
 (defun eval-expression (eval-expression-arg
@@ -1253,9 +1256,11 @@ (defun eval-expression (eval-expression-arg
 this command arranges for all errors to enter the debugger."
   (interactive
    (list (let ((minibuffer-completing-symbol t))
-	   (read-from-minibuffer "Eval: "
-				 nil read-expression-map t
-				 'read-expression-history))
+	   (minibuffer-with-setup-hook
+	       (lambda () (run-hooks 'eval-expression-minibuffer-setup-hook))
+	     (read-from-minibuffer "Eval: "
+				   nil read-expression-map t
+				   'read-expression-history)))
 	 current-prefix-arg))
 
   (if (null eval-expression-debug-on-error)
-- 
1.8.2


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 03:41:01 GMT) Full text and rfc822 format available.

Message #14 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 07:39:18 +0400
Leo Liu <sdl.web <at> gmail.com> writes:
>> Shouldn't that be called `eldoc-minibuffer-mode'?
>> And why not just use eldoc-mode?
>
> eldoc-post-insert-mode can work everywhere not just in the minibuffer.
> The idea is from me finding eldoc-mode too distracting by printing
> 'constantly' to the echo area. Thus eldoc-post-insert-mode only shows
> the info when you are typing. (For me it shows the info at the moment I
> need it ;)).

I think you might want to make this configurable. Personally, I like
that I can move point inside a function call in existing code, and it
will show the argument names and which argument I'm on.

It should be as useful when editing an expression to be evaluated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 03:59:02 GMT) Full text and rfc822 format available.

Message #17 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13978 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 11:57:02 +0800
On 2013-03-17 11:39 +0800, Dmitry Gutov wrote:
> I think you might want to make this configurable. Personally, I like
> that I can move point inside a function call in existing code, and it
> will show the argument names and which argument I'm on.
>
> It should be as useful when editing an expression to be evaluated.

Certainly. No feature is removed. we have eldoc-mode to do what you
want. eldoc-post-insert-mode does nothing when eldoc-mode is enabled.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 04:04:02 GMT) Full text and rfc822 format available.

Message #20 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 08:01:42 +0400
On 17.03.2013 7:57, Leo Liu wrote:
> On 2013-03-17 11:39 +0800, Dmitry Gutov wrote:
>> I think you might want to make this configurable. Personally, I like
>> that I can move point inside a function call in existing code, and it
>> will show the argument names and which argument I'm on.
>>
>> It should be as useful when editing an expression to be evaluated.
>
> Certainly. No feature is removed. we have eldoc-mode to do what you
> want. eldoc-post-insert-mode does nothing when eldoc-mode is enabled.

Will I be able to use eldoc-mode during eval-expression, then?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 04:11:02 GMT) Full text and rfc822 format available.

Message #23 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13978 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 12:09:04 +0800
On 2013-03-17 12:01 +0800, Dmitry Gutov wrote:
> Will I be able to use eldoc-mode during eval-expression, then?

Yes, of course, eldoc-mode works just as well as eldoc-post-insert-mode
in the minibuffer.

(add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-mode)

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 12:13:01 GMT) Full text and rfc822 format available.

Message #26 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 16:10:28 +0400
Leo Liu <sdl.web <at> gmail.com> writes:

> On 2013-03-17 12:01 +0800, Dmitry Gutov wrote:
>> Will I be able to use eldoc-mode during eval-expression, then?
>
> Yes, of course, eldoc-mode works just as well as eldoc-post-insert-mode
> in the minibuffer.
>
> (add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-mode)

Got it. Sorry for the distraction.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 13:07:02 GMT) Full text and rfc822 format available.

Message #29 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 09:04:53 -0400
>> Will I be able to use eldoc-mode during eval-expression, then?
> Yes, of course, eldoc-mode works just as well as eldoc-post-insert-mode
> in the minibuffer.
> (add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-mode)

Good.  So eldoc-post-insert-mode is an independent feature.
Another option would be to have a boolean eldoc-post-insert variable to
control how eldoc-mode works.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 13:54:01 GMT) Full text and rfc822 format available.

Message #32 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13978 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 21:51:14 +0800
On 2013-03-17 21:04 +0800, Stefan Monnier wrote:
> Another option would be to have a boolean eldoc-post-insert variable to
> control how eldoc-mode works.

It seems two minor modes would still give users more control. We can
think of eldoc-post-insert-mode as a minimal eldoc-mode but still allows
transitioning to a 'full' mode via M-x eldoc-mode.

Leo




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Sun, 17 Mar 2013 15:24:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Sun, 17 Mar 2013 15:24:02 GMT) Full text and rfc822 format available.

Message #37 received at 13978-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13978-done <at> debbugs.gnu.org
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 23:21:48 +0800
I put the code in trunk. Feel free to tweak it as you see fit ;) Thanks
for the review and help.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 15:29:02 GMT) Full text and rfc822 format available.

Message #40 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 11:26:48 -0400
>> Another option would be to have a boolean eldoc-post-insert variable to
>> control how eldoc-mode works.
> It seems two minor modes would still give users more control.

More than what?  They can already do that with enough coding, so the
difference is in how easily they can setup some specific behavior.
I'm not sure it's worth the extra minor mode.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13978; Package emacs. (Sun, 17 Mar 2013 15:58:02 GMT) Full text and rfc822 format available.

Message #43 received at 13978 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13978 <at> debbugs.gnu.org
Subject: Re: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sun, 17 Mar 2013 23:55:40 +0800
On 2013-03-17 23:26 +0800, Stefan Monnier wrote:
> More than what?  They can already do that with enough coding, so the
> difference is in how easily they can setup some specific behavior.
> I'm not sure it's worth the extra minor mode.

A variable is good for permanent change i.e. setup a permanent way to
use eldoc but it sucks when you need to temporarily change the way it
works. A minor mode is a command so users will be able to M-x to get to
it.

Anyway, I don't mind much one way or the other. Feel free to merge the
two modes.

Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 214 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.