all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Debugging Elisp
@ 2013-05-25  9:10 Miguel Guedes
  2013-05-25 13:44 ` Pascal J. Bourguignon
  2013-05-26  9:49 ` Phillip Lord
  0 siblings, 2 replies; 6+ messages in thread
From: Miguel Guedes @ 2013-05-25  9:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hello List,

Is it possible to set up emacs so as to output more meaningful messages 
when it steps into errors?  

I'd be so *very* grateful if someone contributed a tip that makes emacs 
output a line:col pair when it steps into an error as messages of the 
kind below are just so frustrating to debug (especially so when it's hard 
to replicate what causes them):

Error in post-command-hook: (wrong-type-argument characterp wrong-type-
argument) 

-- 
Miguel


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

* Re: Debugging Elisp
  2013-05-25  9:10 Debugging Elisp Miguel Guedes
@ 2013-05-25 13:44 ` Pascal J. Bourguignon
  2013-05-25 19:00   ` Sebastien Vauban
  2013-05-26  9:49 ` Phillip Lord
  1 sibling, 1 reply; 6+ messages in thread
From: Pascal J. Bourguignon @ 2013-05-25 13:44 UTC (permalink / raw)
  To: help-gnu-emacs

Miguel Guedes <miguel.a.guedes@gmail.com> writes:

> Hello List,
>
> Is it possible to set up emacs so as to output more meaningful messages 
> when it steps into errors?  
>
> I'd be so *very* grateful if someone contributed a tip that makes emacs 
> output a line:col pair when it steps into an error as messages of the 
> kind below are just so frustrating to debug (especially so when it's hard 
> to replicate what causes them):
>
> Error in post-command-hook: (wrong-type-argument characterp wrong-type-
> argument) 

M-x set-variable RET debug-on-error RET t RET

Now, in post-command-hooks, when there's an error, the hook is removed
IIRC, so you have to put it back in, or invoke it separately to debug
it.

When you enter the debugger, you can then go over some link and type RET
to jump to the source of the faulty expression.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.
You can take the lisper out of the lisp job, but you can't take the lisp out
of the lisper (; -- antifuchs


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

* Re: Debugging Elisp
  2013-05-25 13:44 ` Pascal J. Bourguignon
@ 2013-05-25 19:00   ` Sebastien Vauban
  2013-05-26  0:43     ` Stefan Monnier
       [not found]     ` <mailman.390.1369529042.22516.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastien Vauban @ 2013-05-25 19:00 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hi Pascal,

"Pascal J. Bourguignon" wrote:
> Miguel Guedes <miguel.a.guedes-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> Is it possible to set up emacs so as to output more meaningful messages 
>> when it steps into errors?  
>>
>> I'd be so *very* grateful if someone contributed a tip that makes emacs 
>> output a line:col pair when it steps into an error as messages of the 
>> kind below are just so frustrating to debug (especially so when it's hard 
>> to replicate what causes them):
>>
>> Error in post-command-hook: (wrong-type-argument characterp wrong-type-
>> argument) 
>
> M-x set-variable RET debug-on-error RET t RET
>
> Now, in post-command-hooks, when there's an error, the hook is removed
> IIRC, so you have to put it back in, or invoke it separately to debug
> it.

What you say here resonates to me. I have the impression (from pragmatic
observations) that `toggle-debug-on-error' just shows the next first error,
then none. While `M-: (setq debug-on-error t)' will work forever.

The feature with `toggle-debug-on-error' is, for me, quite new. I thought it
was some kind of bug. You say it has been done on purpose. I find that very
strange: when I toggle, I know what I'm doing; if I don't want it anymore, I
toggle another time.

Your explanation clears my mind...

Best regards,
  Seb

-- 
Sebastien Vauban


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

* Re: Debugging Elisp
  2013-05-25 19:00   ` Sebastien Vauban
@ 2013-05-26  0:43     ` Stefan Monnier
       [not found]     ` <mailman.390.1369529042.22516.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-05-26  0:43 UTC (permalink / raw)
  To: help-gnu-emacs

> What you say here resonates to me. I have the impression (from pragmatic
> observations) that `toggle-debug-on-error' just shows the next first error,
> then none. While `M-: (setq debug-on-error t)' will work forever.

You misunderstood: toggle-debug-on-error is exactly the same as setting
via setq or set-variable.  What Pascal was referring to is that errors
that occur while running post-command-hook cause the corresponding
function to be removed from the hook (to try and prevent the error from
occurring over and over again), so such errors tend to "occur only once".


        Stefan




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

* Re: Debugging Elisp
  2013-05-25  9:10 Debugging Elisp Miguel Guedes
  2013-05-25 13:44 ` Pascal J. Bourguignon
@ 2013-05-26  9:49 ` Phillip Lord
  1 sibling, 0 replies; 6+ messages in thread
From: Phillip Lord @ 2013-05-26  9:49 UTC (permalink / raw)
  To: Miguel Guedes; +Cc: help-gnu-emacs


The general solution is to turn debug-on-error on then replicate the
error. With post-command-hook on, though, it's much harder because this
hooks so deeply into the Emacs workflow.

Really, you need to find out what is on "post-command-hook" before it
crashes. This will allow you to narrow down a bit on where the problem
is.


Phil

Miguel Guedes <miguel.a.guedes@gmail.com> writes:

> Hello List,
>
> Is it possible to set up emacs so as to output more meaningful messages 
> when it steps into errors?  
>
> I'd be so *very* grateful if someone contributed a tip that makes emacs 
> output a line:col pair when it steps into an error as messages of the 
> kind below are just so frustrating to debug (especially so when it's hard 
> to replicate what causes them):
>
> Error in post-command-hook: (wrong-type-argument characterp wrong-type-
> argument) 

-- 
Phillip Lord,                           Phone: +44 (0) 191 222 7827
Lecturer in Bioinformatics,             Email: phillip.lord@newcastle.ac.uk
School of Computing Science,            http://homepages.cs.ncl.ac.uk/phillip.lord
Room 914 Claremont Tower,               skype: russet_apples
Newcastle University,                   twitter: phillord
NE1 7RU                                 



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

* Re: Debugging Elisp
       [not found]     ` <mailman.390.1369529042.22516.help-gnu-emacs@gnu.org>
@ 2013-05-26 19:12       ` Sebastien Vauban
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Vauban @ 2013-05-26 19:12 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hello Stefan,

Stefan Monnier wrote:
>> What you say here resonates to me. I have the impression (from pragmatic
>> observations) that `toggle-debug-on-error' just shows the next first error,
>> then none. While `M-: (setq debug-on-error t)' will work forever.
>
> You misunderstood: toggle-debug-on-error is exactly the same as setting
> via setq or set-variable.  What Pascal was referring to is that errors
> that occur while running post-command-hook cause the corresponding
> function to be removed from the hook (to try and prevent the error from
> occurring over and over again), so such errors tend to "occur only once".

Thanks for putting me right on tracks, then. I don't think I've dreamed,
though.

Next time I need to track down some error, and get a backtrace, I'll be much
more careful for testing, and report anything I would consider as being wrong.

Up to that point, then, I'm presumed to be wrong.

Best regards,
  Seb

-- 
Sebastien Vauban


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

end of thread, other threads:[~2013-05-26 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25  9:10 Debugging Elisp Miguel Guedes
2013-05-25 13:44 ` Pascal J. Bourguignon
2013-05-25 19:00   ` Sebastien Vauban
2013-05-26  0:43     ` Stefan Monnier
     [not found]     ` <mailman.390.1369529042.22516.help-gnu-emacs@gnu.org>
2013-05-26 19:12       ` Sebastien Vauban
2013-05-26  9:49 ` Phillip Lord

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.