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.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13978 <at> debbugs.gnu.org
Subject: 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




This bug report was last modified 12 years and 71 days ago.

Previous Next


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