all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Filipp Gunbin <fgunbin@fastmail.fm>
Cc: emacs-devel@gnu.org
Subject: Re: read-char-from-minibuffer ends keyboard macro recording
Date: Sat, 16 Nov 2019 22:51:15 +0200	[thread overview]
Message-ID: <87tv73o8pg.fsf@mail.linkov.net> (raw)
In-Reply-To: <87imnmcbec.fsf@mail.linkov.net> (Juri Linkov's message of "Fri,  15 Nov 2019 00:59:23 +0200")

>> Hi, there's a problem with recent changes to read-char-from-minibuffer
>> (commit 04ab67470706f1c66bdf08e4078ea3dffd79b41e): this function invokes
>> (discard-input) at the very beginning, thus making it impossible to use
>> it as part of the keyboard macro (through zap-to-char or otherwise).
>
> '(discard-input)' was added to swallow some initial events.
> Without it, 'sit-for' in 'minibuffer-message' doesn't wait
> 2 seconds to display the message.  Such events occur only
> at Emacs startup, and they need to be discarded to display
> the message for 2 seconds when the minibuffer is activated
> to ask a question about loading the desktop or visiting
> a file with local variables loaded from the desktop.
>
> We need first to solve the problem with initial events
> before removing '(discard-input)'.

Startup emits various events such as CONFIG_CHANGED_EVENT,
FOCUS_IN_EVENT, MOVE_FRAME_EVENT, ICONIFY_EVENT.

I don't know why run-with-timer doesn't allow handling these events,
but run-with-idle-timer does.  So here's the fix:

diff --git a/lisp/subr.el b/lisp/subr.el
index eaec223585..20daed623f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2707,7 +2707,6 @@ read-char-from-minibuffer
 When HISTORY is a symbol, then allows navigating in a history.
 The navigation commands are `M-p' and `M-n', with `RET' to select
 a character from history."
-  (discard-input)
   (let* ((empty-history '())
          (map (if (consp chars)
                   (or (gethash chars read-char-from-minibuffer-map-hash)
@@ -2847,7 +2846,6 @@ y-or-n-p
 	    answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip)))))
      (t
       (setq prompt (funcall padded prompt))
-      (discard-input)
       (let* ((empty-history '())
              (str (read-from-minibuffer
                    prompt nil
@@ -4622,7 +4620,7 @@ do-after-load-evaluation
 					  byte-compile-current-file
 					  byte-compile-root-dir)))
 	      (byte-compile-warn "%s" msg))
-	  (run-with-timer 0 nil
+	  (run-with-idle-timer 0 nil
 			  (lambda (msg)
 			    (minibuffer-message "%s" msg))
 			  msg)))))



  reply	other threads:[~2019-11-16 20:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 20:03 read-char-from-minibuffer ends keyboard macro recording Filipp Gunbin
2019-11-14 22:59 ` Juri Linkov
2019-11-16 20:51   ` Juri Linkov [this message]
2019-11-25 12:30     ` Filipp Gunbin

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=87tv73o8pg.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=fgunbin@fastmail.fm \
    /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.