explain-pause-mode icon indicating copy to clipboard operation
explain-pause-mode copied to clipboard

Frames do not match in 'not top level in wrap-native for #<subr read-from-minibuffer>' (root-cause: native-comp branch doesn't respect advices yet... I think)

Open jakejx opened this issue 4 years ago • 12 comments

Hi, I decided to give this cool package a try.

Once the package is enabled, any time I try to access M-x with ivy I get the following error message. For reference, I am using the native-compile branch of Emacs on a linux machine with Spacemacs.

frames do not match in 'not top level in wrap-native for #<subr read-from-minibuffer>'
current:
#s(explain-pause-command-record root-emacs nil nil 63056 (24323 4741 255931 522000) nil nil nil nil 0)
test:
#s(explain-pause-command-record root-emacs nil nil 63056 (24323 4741 255931 522000) nil nil nil nil 0)


Backtrace:
  backtrace()
  explain-pause-report-measuring-bug("not top level in wrap-native for #<subr read-from-..." #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 63056 :entry-snap (24323 4741 255931 522000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 63056 :entry-snap (24323 4741 255931 522000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0))
  explain-pause--wrap-native(#<subr read-from-minibuffer> "M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history)
  apply(explain-pause--wrap-native #<subr read-from-minibuffer> ("M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history))
  read-from-minibuffer("M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history)
  ivy-read("M-x " ("explain-pause-mode" "org-mode" "package-install" "visual-fill-column-mode" "visual-line-mode" "prettier-js" "make-directory" "lsp" "emacs-lisp-mode" "typescript-mode" "rename-file" "revert-buffer" "package-delete" "macrostep-expand" "intero-mode" "haskell-mode" "counsel-fonts" "lsp-treemacs-errors-list" "vterm" "all-the-icons-install-fonts" "s" "ca" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "mvn" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" ...) :predicate #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_31> :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  #<subr funcall-interactively>(counsel-M-x)
  apply(#<subr funcall-interactively> counsel-M-x)
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

Let me know how I can help to debug this issue, thanks!

jakejx avatar Jul 06 '20 12:07 jakejx

Hi thank you for trying out explain-pause-mode AND ALSO reporting a bug! At least the reporting bug feature works well now. 😀

So, I use ivy + counsel every day so it's unexpected to see this. From the backtrace, it looks like somehow call-interactively was never called from command-execute, but that's impossible, unless you were recording a keyboard macro, which I'm pretty sure you were not doing.

I suspect that spacemacs is advising or redefining command-execute, or some magic like that. I checked the spacemacs source code but nothing jumped out at me.

Some questions you could answer, please:

  1. Can you run C h f "describe function" on "command-execute" and tell me what, if anything, it says has advised that name?
  2. Can you also run C h f on "call-interactively" and tell me what is advising that function, too?
  3. Also, what version of spacemacs and emacs are you running?
  4. How did you install the mode? Did you install it in init.el? Did you activate it in init.el? Did you activate it via a m-x command? Did you run it via command line?

Thank you for helping me debug this bug!!

lastquestion avatar Jul 06 '20 17:07 lastquestion

Some questions you could answer, please:

  1. Can you run C h f "describe function" on "command-execute" and tell me what, if anything, it says has advised that name?
  2. Can you also run C h f on "call-interactively" and tell me what is advising that function, too?

Unfortunately for both functions, I do not see any advise. I have included the output of both functions just in case:

command-execute is native compiled Lisp function.

(command-execute CMD &optional RECORD-FLAG KEYS SPECIAL)

  Probably introduced at or before Emacs version 19.30.

Execute CMD as an editor command.
CMD must be a symbol that satisfies the ‘commandp’ predicate.
Optional second arg RECORD-FLAG non-nil
means unconditionally put this command in the variable ‘command-history’.
Otherwise, that is done only if an arg is read using the minibuffer.
The argument KEYS specifies the value to use instead of (this-command-keys)
when reading the arguments; if it is nil, (this-command-keys) is used.
The argument SPECIAL, if non-nil, means that this command is executing
a special event, so ignore the prefix argument and don’t clear it.
call-interactively is a built-in function in ‘C source code’.

(call-interactively FUNCTION &optional RECORD-FLAG KEYS)

  Probably introduced at or before Emacs version 19.30.

Call FUNCTION, providing args according to its interactive calling specs.
Return the value FUNCTION returns.
The function contains a specification of how to do the argument reading.
In the case of user-defined functions, this is specified by placing a call
to the function ‘interactive’ at the top level of the function body.
See ‘interactive’.

Optional second arg RECORD-FLAG non-nil
means unconditionally put this command in the variable ‘command-history’.
Otherwise, this is done only if an arg is read using the minibuffer.

Optional third arg KEYS, if given, specifies the sequence of events to
supply, as a vector, if FUNCTION inquires which events were used to
invoke it (via an ‘interactive’ spec that contains, for instance, an
"e" code letter).  If KEYS is omitted or nil, the return value of
‘this-command-keys-vector’ is used.
  1. Also, what version of spacemacs and emacs are you running?

I am using the develop branch of spacemacs on f60997e6a63319191c8328f241d93228b5e2264d. For emacs, I am using the native compiled emacs branch (don't remember the exact commit used).

  1. How did you install the mode? Did you install it in init.el? Did you activate it in init.el? Did you activate it via a m-x command? Did you run it via command line?

I installed it by adding it to the load path via the dotspacemacs-additional-packages variable and added this to the bottom of my user configuration:

  (require 'explain-pause-mode)
  (explain-pause-mode)

I will try using the non-native emacs version and see whether the issue still occurs but that may take some time as I am not super keen on recompiling emacs right now. Hope it helps!

jakejx avatar Jul 07 '20 09:07 jakejx

Ahhhhhh, I know what's wrong. Or at least, I know what's immediately wrong. I don't know what's causing the actual deeper problem, but I do know why there is no advice.

Something is breaking during install such that the advise-install is failing half way or something like this. Further, when you said you added it to "the bottom of my user configuration", does that mean you added it to init.el or to some spacemacs user configuration file?

I will push a fix so that errors during install will cause the report-bug message to popup, but here are two more things in the meantime that you can try that will help verify my guess:

  1. Run emacs -Q -l <path to explain-pause-mode.el> and then run M-x explain-pause mode. This should work, and rules out native-comp. Then try loading a file or opening the explain-pause-top to verify it works.
  2. Run your usual full emacs, do not activate the mode in init.el, but then activate it manually via M-x explain-pause-mode. Then check *Messages*. You should see something like Error in post command hook... in there. If so, this means at least my initial guess is right.
  3. call-interactively should be called, even in native-comp, I checked the source code. I think you have a customized something. We'll discover if that's true if (1) works.

lastquestion avatar Jul 07 '20 15:07 lastquestion

post-command-hooks do not ever break into debugger, so there's no real way to know what actually died unless I add some code. So the PR will at least allow us to learn what actually did fail. If my guess is right, that is... 😀

lastquestion avatar Jul 07 '20 15:07 lastquestion

Hi, I just merged https://github.com/lastquestion/explain-pause-mode/pull/68 which catches all errors during install and opens a bug report buffer. Can you try that and let me know what happens?

lastquestion avatar Jul 08 '20 03:07 lastquestion

Some updates after testing:

  1. Run emacs -Q -l <path to explain-pause-mode.el> and then run M-x explain-pause mode. This should work, and rules out native-comp. Then try loading a file or opening the explain-pause-top to verify it works.

Yeap this seems to work fine so its probably not an issue with native-comp.

  1. Run your usual full emacs, do not activate the mode in init.el, but then activate it manually via M-x explain-pause-mode. Then check *Messages*. You should see something like Error in post command hook... in there. If so, this means at least my initial guess is right.

I just pulled the latest commit 3d33cd30edee96dc27246cb688c6c61dac0246e9 and tried it out. When I activate explain-pause-mode nothing happens, but once I trigger ivy I am getting ivy-read: Symbol’s function definition is void: backtrace--print-frame

jakejx avatar Jul 10 '20 07:07 jakejx

Progress, it's trying to print a stacktrace. Yay!

But, https://github.com/emacs-mirror/emacs/commit/83af893fc0e7cc87c0fb0626fb48ef96e00b3f8b backtrace--print-frame was removed in this commit.

I apparently didn't ACTUALLY run the unit tests in emacs 27+, embarrassing :'(

I fixed that in https://github.com/lastquestion/explain-pause-mode/pull/70 and merged it, can you try again with HEAD.

Just to double check, when you said you activated it, you activated via m-x right? It should install itself on the next command via post-command-hook. With latest HEAD, can you try this exactly:

  1. Load the file
  2. Open messages buffer ahead of time so you don't have to run ivy or counsel
  3. M-x explain-pause-mode
  4. Type 'g' or something, this is not a valid command in the messages buffer but it doesn't matter
  5. Check messages buffer. Did it say "Explain-pause-mode enabled."? Note the -, there should be two messages one without dashes and one with. (I know it's confusing, I am planning on cleaning up that message. sorry 😀 )
  6. If it did not, a buffer should hopefully have popped up with report bug info.
  7. If the buffer did not popup, then can you list every package you have installed. how long is the list? 😢 I am really hoping that an error buffer pops up during install...

lastquestion avatar Jul 10 '20 16:07 lastquestion

Hey sorry for the delay, been pretty busy. I just tested on the latest commit 319ba9aa1ab2e185a4085dc685007a35213a6e86.

  1. Load the file
  2. Open messages buffer ahead of time so you don't have to run ivy or counsel
  3. M-x explain-pause-mode
  4. Type 'g' or something, this is not a valid command in the messages buffer but it doesn't matter

When enabling explain-pause-mode, I do not get any errors. I get both messages saying that the mode is enabled. However, when I try to use ivy/counsel, I get the backtrace, which I believe is similarly to the original one.

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-from-minibuffer>
current
#s(explain-pause-command-record root-emacs nil nil 20757 (24336 16797 277923 204000) nil nil nil nil 0)

Backtrace:
  explain-pause-report-measuring-bug("not top level in wrap-native for #<subr read-from-..." "current" #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 20757 :entry-snap (24336 16797 277923 204000) :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-from-minibuffer> "M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history)
  apply(explain-pause--wrap-native #<subr read-from-minibuffer> ("M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history))
  read-from-minibuffer("M-x " "^" (keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) keymap (escape . minibuffer-keyboard-quit) (12 . ivy-alt-done) (33554440 keymap (113 . help-quit) (118 . describe-variable) (119 . where-is) (116 . help-with-tutorial) (115 . describe-syntax) (114 . info-emacs-manual) (80 . describe-package) (112 . finder-by-keyword) (110 . view-emacs-news) (111 . describe-symbol) (109 . describe-mode) (108 . view-lossage) (107 . describe-key) (52 keymap (105 . info-other-window)) (105 . info) (104 . view-hello-file) (103 . describe-gnu-project) (102 . describe-function) (101 . view-echo-area-messages) (100 . apropos-documentation) (99 . describe-key-briefly) (98 . describe-bindings) (97 . apropos-command) (83 . info-lookup-symbol) (76 . describe-language-environment) (75 . Info-goto-emacs-key-command-node) (73 . describe-input-method) (70 . Info-goto-emacs-command-node) (67 . describe-coding-system) (28 . describe-input-method) (23 . describe-no-warranty) (20 . view-emacs-todo) (19 . search-forward-help-for-help) (16 . view-emacs-problems) (15 . describe-distribution) (14 . view-emacs-news) (13 . view-order-manuals) (6 . view-emacs-FAQ) (5 . view-external-packages) (4 . view-emacs-debugging) (3 . describe-copying) (1 . about-emacs) (63 . help-for-help) (46 . display-local-help) (f1 . help-for-help) (help . help-for-help) (8 . help-for-help)) (8 . "\177") (11 . ivy-previous-line) (36 . ivy-magic-read-file-env) (3 keymap (19 . ivy-rotate-sort) (1 . ivy-toggle-ignore) (15 . ivy-occur)) (33554464 . ivy-restrict-to-matches) (15 . hydra-ivy/body) (22 . ivy-scroll-up-command) (prior . ivy-scroll-down-command) (next . ivy-scroll-up-command) (7 . minibuffer-keyboard-quit) (right . ivy-forward-char) (32 . self-insert-command) (18 . ivy-reverse-i-search) (remap keymap (describe-mode . ivy-help) (kill-ring-save . ivy-kill-ring-save) (kill-whole-line . ivy-kill-whole-line) (kill-line . ivy-kill-line) (scroll-down-command . ivy-scroll-down-command) (scroll-up-command . ivy-scroll-up-command) (end-of-buffer . ivy-end-of-buffer) (beginning-of-buffer . ivy-beginning-of-buffer) (kill-word . ivy-kill-word) (forward-char . ivy-forward-char) (delete-char . ivy-delete-char) (backward-kill-word . ivy-backward-kill-word) (backward-delete-char-untabify . ivy-backward-delete-char) (delete-backward-char . ivy-backward-delete-char) (previous-line . ivy-previous-line) (next-line . ivy-next-line)) (9 . ivy-partial-or-done) (10 . ivy-next-line) (27 keymap (32 . hydra-ivy/body) (1 . ivy-read-action) (15 . ivy-dispatching-call) (111 . ivy-dispatching-done) (25 . ivy-insert-current-full) (105 . ivy-insert-current) (106 . ivy-yank-word) (114 . ivy-toggle-regexp-quote) (97 . ivy-toggle-marks) (16 . ivy-previous-line-and-call) (14 . ivy-next-line-and-call) (118 . ivy-scroll-down-command) (112 . ivy-previous-history-element) (110 . ivy-next-history-element) (10 . ivy-immediate-done) (13 . ivy-call)) (mouse-3 . ivy-mouse-dispatching-done) (mouse-1 . ivy-mouse-done) (down-mouse-1 . ignore) (13 . ivy-done)) nil counsel-M-x-history)
  ivy-read("M-x " ("explain-pause-mode" "make-directory" "emacs-lisp-mode" "explain-pause-top" "org-mode" "package-install" "visual-fill-column-mode" "visual-line-mode" "prettier-js" "lsp" "typescript-mode" "rename-file" "revert-buffer" "package-delete" "macrostep-expand" "intero-mode" "haskell-mode" "counsel-fonts" "lsp-treemacs-errors-list" "vterm" "all-the-icons-install-fonts" "s" "ca" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "mvn" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" ...) :predicate #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_31> :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  #<subr funcall-interactively>(counsel-M-x)
  apply(#<subr funcall-interactively> counsel-M-x)
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

jakejx avatar Jul 16 '20 12:07 jakejx

Curiously, I've had an error in the exact same function, but with a slightly different cause.

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 13403357 (24336 4785 995038 705000) 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 13403357 :entry-snap (24336 4785 995038 705000) :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> nil t 2)
  apply(explain-pause--wrap-native #<subr read-event> (nil t 2))
  read-event(nil t 2)
  sit-for(2)
  explain-pause-log--missing-socket-disable()
  (if (eq (aref explain-pause-log--dgram-buffer 0) next) (explain-pause-log--missing-socket-disable) (let* ((v explain-pause-log--dgram-buffer) (v (+ (aref explain-pause-log--dgram-buffer 1) 2))) (aset v v str)) (let* ((v explain-pause-log--dgram-buffer)) (aset v 1 next)))
  (let ((next (% (1+ (aref explain-pause-log--dgram-buffer 1)) explain-pause-log--dgram-buffer-size))) (if (eq (aref explain-pause-log--dgram-buffer 0) next) (explain-pause-log--missing-socket-disable) (let* ((v explain-pause-log--dgram-buffer) (v (+ (aref explain-pause-log--dgram-buffer 1) 2))) (aset v v str)) (let* ((v explain-pause-log--dgram-buffer)) (aset v 1 next))))
  (cond ((eq (car err) 'file-missing) (explain-pause-log--missing-socket-disable)) ((eq (car err) 'file-error) (let ((next (% (1+ (aref explain-pause-log--dgram-buffer 1)) explain-pause-log--dgram-buffer-size))) (if (eq (aref explain-pause-log--dgram-buffer 0) next) (explain-pause-log--missing-socket-disable) (let* ((v explain-pause-log--dgram-buffer) (v (+ ... 2))) (aset v v str)) (let* ((v explain-pause-log--dgram-buffer)) (aset v 1 next))))))
  (condition-case err (progn (while (not (eq (aref explain-pause-log--dgram-buffer 0) (aref explain-pause-log--dgram-buffer 1))) (process-send-string explain-pause-log--send-process (aref explain-pause-log--dgram-buffer (+ (aref explain-pause-log--dgram-buffer 0) 2))) (let* ((v explain-pause-log--dgram-buffer)) (aset v 0 (% (1+ (aref explain-pause-log--dgram-buffer 0)) explain-pause-log--dgram-buffer-size)))) (process-send-string explain-pause-log--send-process str)) (file-error (cond ((eq (car err) 'file-missing) (explain-pause-log--missing-socket-disable)) ((eq (car err) 'file-error) (let ((next (% ... explain-pause-log--dgram-buffer-size))) (if (eq (aref explain-pause-log--dgram-buffer 0) next) (explain-pause-log--missing-socket-disable) (let* (... ...) (aset v v str)) (let* (...) (aset v 1 next))))))))
  explain-pause-log--send-dgram("(\"enter\" \"weechat--relay-process-filter\" \"root-ema...")
  (progn (explain-pause-log--send-dgram (format "(\"enter\" \"%s\" \"%s\" \"%s\" %s %s %s %s %s %d)\n" (explain-pause--command-as-string (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 1))) (explain-pause--command-as-string (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... entry))) (aref entry 1))) (explain-pause--command-as-string (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... ...))) (aref (progn (or ... ...) (aref record 3)) 1))) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 2)) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 4)) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 6)) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 7)) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 8)) (progn (or (and (memq (type-of record) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record record))) (aref record 10)))))
  (if explain-pause-log--send-process (progn (explain-pause-log--send-dgram (format "(\"enter\" \"%s\" \"%s\" \"%s\" %s %s %s %s %s %d)\n" (explain-pause--command-as-string (progn (or (and ... t) (signal ... ...)) (aref record 1))) (explain-pause--command-as-string (progn (or (and ... t) (signal ... ...)) (aref entry 1))) (explain-pause--command-as-string (progn (or (and ... t) (signal ... ...)) (aref (progn ... ...) 1))) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 2)) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 4)) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 6)) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 7)) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 8)) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... record))) (aref record 10))))))
  explain-pause-log--send-command-entry(#s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 13403357 :entry-snap (24336 4785 995038 705000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) #s(explain-pause-command-record :command weechat--relay-process-filter :native nil :parent #s(explain-pause-command-record :command process-filter :native nil :parent #s(explain-pause-command-record :command "weechat-relay-tls" :native nil :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 13403357 :entry-snap (24336 4785 995038 705000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 2) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 3))
  (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 (memq (type-of new-frame) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record new-frame))) (let* ((v new-frame)) (aset v 5 (current-time)))) (unwind-protect (apply original-cb args) (explain-pause--command-record-and-store new-frame) (if should-profile (progn (explain-pause--command-record--save-and-stop-profiling new-frame))) (explain-pause-log--send-command-exit new-frame) (if (not (eq explain-pause--current-command-record new-frame)) (explain-pause-report-measuring-bug (format "wrap callback for %s" original-cb) "current" explain-pause--current-command-record "should be equal" new-frame) (explain-pause--run-measure-hook new-frame) (progn (or (and (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... current-record))) (let* ((v current-record)) (aset v 5 (current-time)))) (setq explain-pause--current-command-record current-record)))))
  (let ((new-frame (explain-pause--command-record-from-parent current-record parent-command-record original-cb))) (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 (memq (type-of new-frame) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record new-frame))) (let* ((v new-frame)) (aset v 5 (current-time)))) (unwind-protect (apply original-cb args) (explain-pause--command-record-and-store new-frame) (if should-profile (progn (explain-pause--command-record--save-and-stop-profiling new-frame))) (explain-pause-log--send-command-exit new-frame) (if (not (eq explain-pause--current-command-record new-frame)) (explain-pause-report-measuring-bug (format "wrap callback for %s" original-cb) "current" explain-pause--current-command-record "should be equal" new-frame) (explain-pause--run-measure-hook new-frame) (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 5 ...))) (setq explain-pause--current-command-record current-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 parent-command-record original-cb))) (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 (memq ... cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list ... new-frame))) (let* ((v new-frame)) (aset v 5 (current-time)))) (unwind-protect (apply original-cb args) (explain-pause--command-record-and-store new-frame) (if should-profile (progn (explain-pause--command-record--save-and-stop-profiling new-frame))) (explain-pause-log--send-command-exit new-frame) (if (not (eq explain-pause--current-command-record new-frame)) (explain-pause-report-measuring-bug (format "wrap callback for %s" original-cb) "current" explain-pause--current-command-record "should be equal" new-frame) (explain-pause--run-measure-hook new-frame) (progn (or ... ...) (let* ... ...)) (setq explain-pause--current-command-record current-record)))))))
  (if (not explain-pause-mode) (apply original-cb args) (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 parent-command-record original-cb))) (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-cb 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-callback(#s(explain-pause-command-record :command process-filter :native nil :parent #s(explain-pause-command-record :command "weechat-relay-tls" :native nil :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 13403357 :entry-snap (24336 4785 995038 705000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 2) weechat--relay-process-filter #<process weechat-relay-tls> "\0\0\1}\0\0\0\0\22_buffer_line_addedhda\0\0\0\11line_data\0\0\0fbuf...")
  apply(explain-pause--wrap-callback #s(explain-pause-command-record :command process-filter :native nil :parent #s(explain-pause-command-record :command "weechat-relay-tls" :native nil :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 13403357 :entry-snap (24336 4785 995038 705000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 2) weechat--relay-process-filter (#<process weechat-relay-tls> "\0\0\1}\0\0\0\0\22_buffer_line_addedhda\0\0\0\11line_data\0\0\0fbuf..."))
  (closure ((original-callback . weechat--relay-process-filter) (parent-command-record . #s(explain-pause-command-record :command process-filter :native nil :parent #s(explain-pause-command-record :command "weechat-relay-tls" :native nil :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 13403357 :entry-snap (24336 4785 995038 705000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 2)) explain-pause-top-mode-abbrev-table explain-pause-top-mode-syntax-table cl-struct-explain-pause-top--command-entry-tags cl-struct-explain-pause-top--table-display-entry-tags cl-struct-explain-pause-top--table-tags cl-struct-explain-pause-command-record-tags explain-pause-mode t) (&rest callback-args) (apply 'explain-pause--wrap-callback parent-command-record original-callback callback-args))(#<process weechat-relay-tls> "\0\0\1}\0\0\0\0\22_buffer_line_addedhda\0\0\0\11line_data\0\0\0fbuf...")

bqv avatar Jul 16 '20 20:07 bqv

This is very useful @jakejx.

I am now convinced that the mode has correctly installed. So now I am thinking very carefully about how it might be possible that call-interactively is not being called. So I just pulled HEAD of emacs, and rebuilt completely, and I still get:

command-execute is a compiled Lisp function in ‘simple.el’.

Yet yours says

command-execute is native compiled Lisp function.

That string comes from help-fns-function-description-header, and the sources of that function doesn't include the string native at all in emacs HEAD.

But it does exist in native-comp: https://github.com/emacs-mirror/emacs/blame/907618b3b51a653d111d7f5764da586fcee6da5e/lisp/help-fns.el#L748

Which leads me to ask, what the hell is the native-comp branch doing? I actually had assumed it was native-composition, e.g. like, better native rendering. But actually, now I can assume it is native-compile, based on subr-native-elisp-p, and comp.c. So I guess it's compiling elisp via GCC JIT style, based on just reading the function names in comp.c. Which I guess means command-execute is now compiled into native C.

But even if it was native C that was compiled from elisp, the call from command-execute to call-interactively should still obey advices on call-interactively. Or else native-comp branch will break all sorts of packages written by all sorts of people. So I think really this might be a bug in native-comp. So google leads me to https://akrl.sdf.org/gccemacs.html, grepping this seems to me that this branch is still under very active development, and I don't know if the author has thought about what happens when elisp advises a function that might be natively compiled by GCC.

I'm not quite sure what I want do next here. I suspect this would be feature work that branch author probably knows about already. Looks like the author is on gitlab... https://gitlab.com/koral.

This weekend if I have time I will try to pull the branch and make a reduced repro, which I can guess just goes something like this

(defun caller ()
  (callee))

(defun callee ()
  t)

;; do the magic compile-y thing of the above which I don't know what it is 
;; because I've only skimmed the link 
(advice-add 'callee :around (lambda (&rest args) "Replaced by advice"))

;; this should return "Replaced by advice" but I bet it will return t
(caller)

@jakejx if you're feeling like you want to investigate more, I bet the above will reproduce that advices don't update the compiled functions and therefore don't work after compilation occurs. If you know how to compile stuff, that would be helpful to test my theory. :_)

lastquestion avatar Jul 17 '20 05:07 lastquestion

@bqv , the bug you posted is the same native function wrapping, that's true, but it's from a unrelated root cause. I moved it to a new issue #77, please follow that one there :_)

lastquestion avatar Jul 17 '20 05:07 lastquestion

I have posted bug report for native-comp branch. The author says that advicing primitives is simply not supported (yet).

https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-07/msg01023.html

yantar92 avatar Jul 28 '20 09:07 yantar92