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

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

bug#38560: 27.0.50; Emacs ignores input events during startup


From: Juri Linkov
Subject: bug#38560: 27.0.50; Emacs ignores input events during startup
Date: Thu, 12 Dec 2019 01:07:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> I already created a fix for this a week ago in bug#38457,
>> but you didn't allow me to install the fix.  That's unfair
>> to blame me for problems that you don't allow to fix.
>
> I didn't blame anyone, I tried to help Dmitry find the changes
> responsible for the issue he was reporting.
>
> What fix was supposed to correct this?  Please show the URL.

Below is the output of 'C-1 C-x v L 245957c196 RET' that shows
that this fix was committed 2019-12-02.

Here's the reconstruction of events leading to this situation.
As your previous message shows:

>   commit 54c792ece6c20297571aa68c613075c8a8152bcc
>   Author:     Juri Linkov <juri@linkov.net>
>   AuthorDate: Sat Nov 30 23:33:41 2019 +0200
>   Commit:     Juri Linkov <juri@linkov.net>
>   CommitDate: Sat Nov 30 23:33:41 2019 +0200
>
>       * lisp/subr.el: Add discard-input to more functions.

That's right, I committed this change at Sat Nov 30.
Then it took me less than 2 days to realize there are
problems with this in do-after-load-evaluation and also to
notice other problems with dabbrev, Tramp, icomplete.
Then I immediately created a patch to finish implementation
of this feature that fixed all related problems with the patch
below committed to the local repository.  Then I posted
the first part of the patch in hope to push the remaining
part immediately afterwards.

commit 245957c196e3f982893733b7f025c8d55b28f23b
Author: Juri Linkov <juri@linkov.net>
Date:   2019-12-02 19:59:04 +0200

    * lisp/minibuffer.el: Add minibuffer-message-timer, 
minibuffer-message-overlay

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a7bdde478f..3febdeb174 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -702,6 +702,9 @@ minibuffer
 (defvar minibuffer-message-properties nil
   "Text properties added to the text shown by `minibuffer-message'.")
 
+(defvar minibuffer-message-timer nil)
+(defvar minibuffer-message-overlay nil)
+
 (defun minibuffer-message (message &rest args)
   "Temporarily display MESSAGE at the end of the minibuffer.
 The text is displayed for `minibuffer-message-timeout' seconds,
@@ -732,24 +735,23 @@ minibuffer-message
                 ;; Don't overwrite the face properties the caller has set
                 (text-properties-at 0 message))
       (setq message (apply #'propertize message 
minibuffer-message-properties)))
-    (let ((ol (make-overlay (point-max) (point-max) nil t t))
-          ;; A quit during sit-for normally only interrupts the sit-for,
-          ;; but since minibuffer-message is used at the end of a command,
-          ;; at a time when the command has virtually finished already, a C-g
-          ;; should really cause an abort-recursive-edit instead (i.e. as if
-          ;; the C-g had been typed at top-level).  Binding inhibit-quit here
-          ;; is an attempt to get that behavior.
-          (inhibit-quit t))
-      (unwind-protect
-          (progn
-            (unless (zerop (length message))
-              ;; The current C cursor code doesn't know to use the overlay's
-              ;; marker's stickiness to figure out whether to place the cursor
-              ;; before or after the string, so let's spoon-feed it the pos.
-              (put-text-property 0 1 'cursor t message))
-            (overlay-put ol 'after-string message)
-            (sit-for (or minibuffer-message-timeout 1000000)))
-        (delete-overlay ol)))))
+
+    (when (timerp minibuffer-message-timer)
+      (cancel-timer minibuffer-message-timer))
+    (when (overlayp minibuffer-message-overlay)
+      (delete-overlay minibuffer-message-overlay))
+    (setq minibuffer-message-overlay
+          (make-overlay (point-max) (point-max) nil t t))
+    (setq minibuffer-message-timer
+          (run-with-timer (or minibuffer-message-timeout 1) nil
+                          (lambda () (when (overlayp 
minibuffer-message-overlay)
+                                       (delete-overlay 
minibuffer-message-overlay)))))
+    (unless (zerop (length message))
+      ;; The current C cursor code doesn't know to use the overlay's
+      ;; marker's stickiness to figure out whether to place the cursor
+      ;; before or after the string, so let's spoon-feed it the pos.
+      (put-text-property 0 1 'cursor t message))
+    (overlay-put minibuffer-message-overlay 'after-string message)))
 
 (defun minibuffer-completion-contents ()
   "Return the user input in a minibuffer before point as a string.
diff --git a/lisp/subr.el b/lisp/subr.el
index de7d919abf..a9d4443810 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4609,7 +4609,7 @@ do-after-load-evaluation
                                       (string-match "\\.elc?\\>" file))
                             obarray))
           (msg (format "Package %s is deprecated" package))
-          (fun (lambda (msg) (discard-input) (message "%s" msg))))
+          (fun (lambda (msg) (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]