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

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

Print eldoc information interactively (was: Re: major mode for G-Code?)


From: Felix Dietrich
Subject: Print eldoc information interactively (was: Re: major mode for G-Code?)
Date: Wed, 06 Apr 2022 04:20:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Works but ... I wonder if you could get `eldoc-mode' to not be
> based on inactivity and then display (after the timeout) but
> never say anything unless the user hits a key to display
> it ...

Maybe it would be enough to just yank the relevant code out of
‘eldoc-print-current-symbol-info’?

  #+begin_src emacs-lisp
    (defun my/eldoc-print-current-symbol-info ()
      (interactive)
      (with-demoted-errors "eldoc error: %s"
        (let ((non-essential t))
          ;; Only keep looking for the info as long as the user hasn't
          ;; requested our attention.  This also locally disables
          ;; inhibit-quit.
          (while-no-input
            (eldoc-message (funcall eldoc-documentation-function))))))
  #+end_src

You canʼt just make ‘eldoc-print-current-symbol-info’ interactive
because of the (not this-command) test in ‘eldoc-display-message-p’:

  #+begin_src emacs-lisp
    ;; Decide whether now is a good time to display a message.
    (defun eldoc-display-message-p ()
      "Return non-nil when it is appropriate to display an ElDoc message."
      (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.
           (not this-command)
           (eldoc--message-command-p last-command)))
  #+end_src

-- 
Felix Dietrich



reply via email to

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