all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* wrong-number-of-arguments in post-command-hook
@ 2020-03-13 16:23 ndame
  2020-03-16 15:23 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: ndame @ 2020-03-13 16:23 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

I'm working on some code using post command hook and there were some errors
in it which were not trivial to find, because post-command-hook does not print
backtraces when debug on error is enabled.

It prints an error message though, here are two examples from my code:

Error in post-command-hook (my-post-command): (wrong-number-of-arguments (2 . 2) 1)

Error in post-command-hook (my-post-command): (wrong-type-argument listp t)


Seeing these I was wondering why the error does not contain the called function name.
Is that info not available? It could help debugging a lot if the error also printed the 
function name alongside with the error.

[-- Attachment #2: Type: text/html, Size: 735 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong-number-of-arguments in post-command-hook
  2020-03-13 16:23 wrong-number-of-arguments in post-command-hook ndame
@ 2020-03-16 15:23 ` Stefan Monnier
  2020-03-17  5:59   ` ndame
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2020-03-16 15:23 UTC (permalink / raw)
  To: ndame; +Cc: emacs-devel@gnu.org

> Error in post-command-hook (my-post-command): (wrong-type-argument listp t)
>
> Seeing these I was wondering why the error does not contain the called function name.
> Is that info not available?

More or less: it's in the stack somewhere, but it's not trivial to
extract that info reliably.  The code that runs the hook does
store&print the name of the top-level function called
(`my-post-command` here) to try and help a bit.

> It could help debugging a lot if the error also printed the 
> function name alongside with the error.

Have you tried `M-: (my-post-command) RET`?


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong-number-of-arguments in post-command-hook
  2020-03-16 15:23 ` Stefan Monnier
@ 2020-03-17  5:59   ` ndame
  2020-03-17 13:12     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: ndame @ 2020-03-17  5:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 120 bytes --]

> Have you tried `M-: (my-post-command) RET`?

For some reason this radical approach didn't even occur to me. :) Thanks.

[-- Attachment #2: Type: text/html, Size: 140 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong-number-of-arguments in post-command-hook
  2020-03-17  5:59   ` ndame
@ 2020-03-17 13:12     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2020-03-17 13:12 UTC (permalink / raw)
  To: ndame; +Cc: emacs-devel@gnu.org

>> Have you tried `M-: (my-post-command) RET`?
> For some reason this radical approach didn't even occur to me. :) Thanks.

Of course, you shouldn't need that: the normal debugger should kick in
"the normal way".  You might want to file a bug report.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-17 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-13 16:23 wrong-number-of-arguments in post-command-hook ndame
2020-03-16 15:23 ` Stefan Monnier
2020-03-17  5:59   ` ndame
2020-03-17 13:12     ` Stefan Monnier

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.