unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Simon Katz <sk@nomistech.com>
Cc: 50042@debbugs.gnu.org
Subject: bug#50042: 26.3; Post-command hooks slow with M-x commands
Date: Fri, 13 Aug 2021 14:27:42 +0200	[thread overview]
Message-ID: <87lf55edhd.fsf@gnus.org> (raw)
In-Reply-To: <CAPXG94-tJ0fn_zeJFkCoQwqiMJLJsSQcK-_TyKEn5_16K9odHQ@mail.gmail.com> (Simon Katz's message of "Fri, 13 Aug 2021 12:52:32 +0100")

Simon Katz <sk@nomistech.com> writes:

> Here's a startup file that can be used to show this (also at

Simpler repro:

(add-hook 'post-command-hook
	  (lambda ()
	    (let ((inhibit-message t))
	      (message "foo: %s" this-command))))
(display-buffer "*Messages*")

M-x previous-line

I think this has something to do with the

You can run the command ‘previous-line’ with C-p

stuff -- if the `M-x' command in question isn't bound to anything,
`post-command-hook' is run immediately instead of after a two-second
timeout.

Hm...  yup:

`execute-extended-command' ends with

        (when binding
          (with-temp-message
              (format-message "You can run the command `%s' with %s"
                              function
                              (if (stringp binding)
                                  (concat "M-x " binding " RET")
                                (key-description binding)))
            (sit-for (if (numberp suggest-key-bindings)
                         suggest-key-bindings
                       2))))))))

So presumably `post-command-hook' isn't run after that timeout has
completed.

Uhm...  anybody got any ideas how to fix this?  I mean, in one way it's
behaving as it's supposed to -- the command really isn't finished after
this sit-for has finished.

On the other hand, it's pretty awkward.

Could we yank this out of the flow and run it from a timer (fired
immediately) instead?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2021-08-13 12:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878s13os3a.fsf@gnus.org>
2021-08-13 11:52 ` bug#50042: 26.3; Post-command hooks slow with M-x commands Simon Katz
2021-08-13 12:27   ` Lars Ingebrigtsen [this message]
2021-08-13 12:40     ` Simon Katz
2021-08-14 16:36     ` Lars Ingebrigtsen
2021-08-14 20:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-15 11:38         ` Lars Ingebrigtsen
2021-08-17  0:41           ` Dmitry Gutov
     [not found]   ` <handler.50042.C.162902754922550.notifdonectrl.0@debbugs.gnu.org>
2021-08-18 15:27     ` bug#50042: acknowledged by developer (control message for bug #50042) Simon Katz
2021-08-18 15:33       ` Simon Katz
2021-08-18 15:37       ` Simon Katz
2021-08-19 13:07         ` Lars Ingebrigtsen
2021-08-19 14:55           ` Simon Katz
2021-08-20 13:09             ` Lars Ingebrigtsen
2021-08-20 16:14               ` Simon Katz
2021-08-21 12:55                 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf55edhd.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=50042@debbugs.gnu.org \
    --cc=sk@nomistech.com \
    /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 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).