unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* read-char-from-minibuffer ends keyboard macro recording
@ 2019-11-14 20:03 Filipp Gunbin
  2019-11-14 22:59 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Filipp Gunbin @ 2019-11-14 20:03 UTC (permalink / raw)
  To: emacs-devel; +Cc: juri

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).

Filipp



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: read-char-from-minibuffer ends keyboard macro recording
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2019-11-14 22:59 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: emacs-devel

> 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)'.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: read-char-from-minibuffer ends keyboard macro recording
  2019-11-14 22:59 ` Juri Linkov
@ 2019-11-16 20:51   ` Juri Linkov
  2019-11-25 12:30     ` Filipp Gunbin
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2019-11-16 20:51 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: emacs-devel

>> 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)))))



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: read-char-from-minibuffer ends keyboard macro recording
  2019-11-16 20:51   ` Juri Linkov
@ 2019-11-25 12:30     ` Filipp Gunbin
  0 siblings, 0 replies; 4+ messages in thread
From: Filipp Gunbin @ 2019-11-25 12:30 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

Thanks, this looks like a good fix.

Filipp



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-25 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-11-25 12:30     ` Filipp Gunbin

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).