all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: help-gnu-emacs@gnu.org
Subject: Print eldoc information interactively (was: Re: major mode for G-Code?)
Date: Wed, 06 Apr 2022 04:20:57 +0200	[thread overview]
Message-ID: <8735irymt2.fsf_-_@sperrhaken.name> (raw)
In-Reply-To: <871qz92gar.fsf@zoho.eu> (Emanuel Berg via Users list for the's message of "Fri, 11 Mar 2022 06:45:32 +0100")

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



      parent reply	other threads:[~2022-04-06  2:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 19:02 major mode for G-Code? Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-10 20:07 ` Jacob Hrbek
2022-03-11  5:09   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11  5:35     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11  6:06       ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11 16:08     ` Jacob Hrbek
2022-03-11 19:54       ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11  5:13   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11  5:31     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11 16:09     ` Jacob Hrbek
2022-03-11 19:55       ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-11  5:45   ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-04-05 21:14     ` TRS-80
2022-04-06  2:20     ` Felix Dietrich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735irymt2.fsf_-_@sperrhaken.name \
    --to=felix.dietrich@sperrhaken.name \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.