bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13978: 24.3; New minor mode eldoc-post-insert-mode


From: Stefan Monnier
Subject: bug#13978: 24.3; New minor mode eldoc-post-insert-mode
Date: Sat, 16 Mar 2013 17:55:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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





reply via email to

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