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

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

bug#50042: 26.3; Post-command hooks slow with M-x commands


From: Lars Ingebrigtsen
Subject: bug#50042: 26.3; Post-command hooks slow with M-x commands
Date: Fri, 13 Aug 2021 14:27:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

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