emacs-diffs
[Top][All Lists]
Advanced

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

master 54c792e: * lisp/subr.el: Add discard-input to more functions.


From: Juri Linkov
Subject: master 54c792e: * lisp/subr.el: Add discard-input to more functions.
Date: Sat, 30 Nov 2019 16:33:49 -0500 (EST)

branch: master
commit 54c792ece6c20297571aa68c613075c8a8152bcc
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/subr.el: Add discard-input to more functions.
    
    * lisp/subr.el (read-char-from-minibuffer-insert-other)
    (y-or-n-p-insert-other): Use discard-input in case of user mistake.
    (do-after-load-evaluation): Add discard-input before calling 'message',
    so in case of the active minibuffer, calling minibuffer-message will allow
    sit-for to wait the complete timeout, because discard-input will discard
    all initial events that prevent sit-for from waiting during startup.
    https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00581.html
---
 lisp/subr.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index c1614c2..de7d919 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2695,6 +2695,7 @@ Also discard all previous input in the minibuffer."
   (interactive)
   (delete-minibuffer-contents)
   (ding)
+  (discard-input)
   (minibuffer-message "Wrong answer")
   (sit-for 2))
 
@@ -2794,6 +2795,7 @@ Also discard all previous input in the minibuffer."
   (interactive)
   (delete-minibuffer-contents)
   (ding)
+  (discard-input)
   (minibuffer-message "Please answer y or n")
   (sit-for 2))
 
@@ -4607,7 +4609,7 @@ This function is called directly from the C code."
                                       (string-match "\\.elc?\\>" file))
                             obarray))
           (msg (format "Package %s is deprecated" package))
-          (fun (lambda (msg) (message "%s" msg))))
+          (fun (lambda (msg) (discard-input) (message "%s" msg))))
       ;; Cribbed from cl--compiling-file.
       (when (or (not (fboundp 'byte-compile-warning-enabled-p))
                 (byte-compile-warning-enabled-p 'obsolete package))



reply via email to

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