lastquestion/explain-pause-mode

not top level in wrap-native for #<subr read-event> (root cause: disabled-command-function hook is called inside command-execute)

Closed this issue · 3 comments

hello!

Explain-pause-mode: please report this bug by creating a Github
issue at https://github.com/lastquestion/explain-pause-mode. Explain-pause-mode
is now _disabled_ so you can continue to hopefully use Emacs. Info follows:

explain-pause version: 0.1
emacs version: 28.0.50

not top level in wrap-native for #<subr read-event>
current
#s(explain-pause-command-record root-emacs nil nil 4449444 (24332 37011 940679 239000) nil nil nil nil 0)

Backtrace:
  explain-pause-report-measuring-bug("not top level in wrap-native for #<subr read-event..." "current" #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 4449444 :entry-snap (24332 37011 940679 239000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0))
  (if (eq explain-pause--current-command-record explain-pause-root-command-loop) (explain-pause-report-measuring-bug (format "not top level in %s" (format "wrap-native for %s" original-func)) "current" explain-pause--current-command-record) (let ((current-record explain-pause--current-command-record)) (explain-pause--command-record-and-store current-record) (let ((new-frame (explain-pause--command-record-from-parent current-record current-record original-func t))) (progn (explain-pause-log--send-command-entry explain-pause--current-command-record new-frame) (setq explain-pause--current-command-record new-frame) (let ((should-profile (explain-pause--command-record-profile-p new-frame))) (if should-profile (progn (explain-pause--command-record-start-profiling new-frame))) (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 5 ...))) (unwind-protect (apply original-func args) (explain-pause--command-record-and-store new-frame) (if should-profile (progn ...)) (explain-pause-log--send-command-exit new-frame) (if (not ...) (explain-pause-report-measuring-bug ... "current" explain-pause--current-command-record "should be equal" new-frame) (explain-pause--run-measure-hook new-frame) (progn ... ...) (setq explain-pause--current-command-record current-record))))))))
  explain-pause--wrap-native(#<subr read-event>)
  apply(explain-pause--wrap-native #<subr read-event> nil)
  read-event()
  disabled-command-function()
  run-hooks(disabled-command-function)
  command-execute(dired-find-alternate-file)

Hi, thanks for reporting (yet another) bug ❤️

This is because command-execute calls disabled-command-function hook when the command is disabled, which means it's not trapped.

I'm not sure how to read the comment and docs for disabled-command-function, there's no proper elisp docs. There's a comment saying "FIXME"; not inspiring... it's called via run-hooks, so hypothetically anyone can add-hook on it, but the documentation set in novice.el implies it's only supposed to be A function.

However, add-hook does work even with it's default value, so I'm going to be defensive and conclude that disabled-command-function should be treated as a regular hook list.

Bug fix incoming...

Hi, thanks for reporting yet another bug 🙏 this is fixed now, I think! I tested list-timers in a emacs -Q which causes disabled-command to fire manually as well.