From: "Ken Manheimer" <ken.manheimer@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: blink-cursor-end sometimes fails and disrupts pre-command-hook
Date: Tue, 22 Aug 2006 17:12:35 -0400 [thread overview]
Message-ID: <2cd46e7f0608221412mbb9104cxdd9bb5723895df32@mail.gmail.com> (raw)
In-Reply-To: <33196.128.165.123.18.1156181003.squirrel@webmail.lanl.gov>
On 8/21/06, Stuart D. Herring <herring@lanl.gov> wrote:
> > that said, i had failed to find/realize that debug-on-signal would
> > cause a debug session at the point of error within the condition case.
> > while not quite what i'm seeking, that will be helpful. is there a
> > reasonable way to substitute a function for the debug session, so it
> > could stash a backtrace and proceed on, rather than invoking user
> > intervention?
>
> C-h v debugger
>
> Does that help?
that was the final piece i needed.
i've just barely started using it, but my post-command-hook has this fragment:
(condition-case failure
[...]
(when allout-widgets-changes-record
(let* ((debug-on-signal t)
(debug-on-error t)
(debugger 'allout-widgets-postcommand-hook-error-handler)
[process the pending changes]
[...]
))
(error (setq allout-widgets-changes-record nil))
and the handler looks like this:
(defun allout-widgets-postcommand-hook-error-handler (mode args)
"Process errors which occurred within the extent of a command hook.
We store a backtrace of the error information in the variable,
`allout-widgets-last-hook-error', unset the error handlers, and
reraise the error, so that processing continues to the
encompassing condition-case."
;; first deconstruct special error environment so errors here propagate
;; to encompassing condition-case:
(setq debugger 'debug
debug-on-error nil
debug-on-signal nil)
(let* ((bt (with-output-to-string (backtrace)))
(this "allout-widgets-postcommand-hook-error-handler")
(header
(format "allout-widgets-last-hook-error stored and posted, %s/%s %s"
this mode args
(format-time-string "%e-%b-%Y %r" (current-time)))))
;; post to *Messages* then immediately replace with more compact notice:
(message (setq allout-widgets-last-hook-error
(format "%s:\n%s" header bt)))
(message header) (sit-for allout-widgets-hook-error-post-time)
;; reraise the error, or one concerning this function if unexpected:
(if (equal mode 'error)
(apply 'signal args)
(error "%s: unexpected mode, %s %s" this mode args))))
i expect this to be very helpful tracking down errors while making my
post-command-hook a "good citizen", unlikely to disrupt the hook due
to uncaught errors.
thanks all for pointing out what i needed to do to record backtraces
at the point of failure.
--
ken
ken.manheimer@gmail.com
http://myriadicity.net
next prev parent reply other threads:[~2006-08-22 21:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-18 22:30 blink-cursor-end sometimes fails and disrupts pre-command-hook Ken Manheimer
2006-08-19 15:07 ` Chong Yidong
[not found] ` <87veoo95zy.fsf@furball.mit.edu>
[not found] ` <2cd46e7f0608190731j6247e8bbr7f7f8d1ecb6ac3ce@mail.gmail.com>
[not found] ` <87r6zc9475.fsf@furball.mit.edu>
[not found] ` <2cd46e7f0608190805x70bd8715n6f1b552d57a80a5c@mail.gmail.com>
2006-08-19 15:16 ` Chong Yidong
2006-08-19 15:58 ` Ken Manheimer
2006-08-19 16:15 ` Chong Yidong
2006-08-19 16:59 ` Ken Manheimer
2006-08-21 15:36 ` Stuart D. Herring
2006-08-20 12:05 ` Richard Stallman
2006-08-20 22:49 ` Ken Manheimer
2006-08-21 7:15 ` David Kastrup
2006-08-21 11:13 ` Richard Stallman
2006-08-21 15:31 ` Ken Manheimer
2006-08-21 17:23 ` Stuart D. Herring
2006-08-22 21:12 ` Ken Manheimer [this message]
2006-08-23 14:45 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2cd46e7f0608221412mbb9104cxdd9bb5723895df32@mail.gmail.com \
--to=ken.manheimer@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).