all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38560@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#38560: 27.0.50; Emacs ignores input events during startup
Date: Thu, 12 Dec 2019 01:07:53 +0200	[thread overview]
Message-ID: <87tv66bgvq.fsf@mail.linkov.net> (raw)
In-Reply-To: <837e33bklz.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 Dec 2019 05:35:04 +0200")

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





  parent reply	other threads:[~2019-12-11 23:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 14:11 bug#38560: 27.0.50; Emacs ignores input events during startup Dmitry Gutov
2019-12-10 14:14 ` Dmitry Gutov
2019-12-10 16:05   ` Eli Zaretskii
2019-12-10 19:41     ` Dmitry Gutov
2019-12-10 23:47     ` Juri Linkov
2019-12-11  3:35       ` Eli Zaretskii
2019-12-11 16:15         ` Eli Zaretskii
2019-12-11 23:07         ` Juri Linkov [this message]
2019-12-12  4:37           ` Eli Zaretskii
2019-12-12 22:43             ` Juri Linkov

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=87tv66bgvq.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=38560@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@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.