emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I debug errors in post-command-hook?


From: Tassilo Horn
Subject: Re: How do I debug errors in post-command-hook?
Date: Fri, 30 Jul 2010 08:54:31 +0200
User-agent: KMail/1.13.5 (Linux/2.6.35-rc6-git4; KDE/4.4.5; x86_64; ; )

On Friday 30 July 2010 02:11:38 Johan Bockgård wrote:

Hi Johan,

> (defadvice lusty--post-command-function (around intercept activate)
>   (condition-case err
>       ad-do-it
>     ;; Let the debugger run
>     ((debug error) (signal (car err) (cdr err)))))

That didn't enter the debugger.  I guess you missed the error as
condition handler.  So I use this advice now:

--8<---------------cut here---------------start------------->8---
(defadvice lusty--post-command-function (around intercept activate)
  (condition-case err
      ad-do-it
    ;; Let the debugger run
    (error (progn (message "%s" err) (debug err)))))
--8<---------------cut here---------------end--------------->8---

And here's the backtrace.

--8<---------------cut here---------------start------------->8---
Debugger entered: ((error "Attempt to modify read-only object"))
  (progn (message "%s" err) (debug err))
  (condition-case err (setq ad-return-value 
(ad-Orig-lusty--post-command-function)) (error (progn ... ...)))
  (let (ad-return-value) (condition-case err (setq ad-return-value ...) (error 
...)) ad-return-value)
  lusty--post-command-function()
  run-hooks(post-command-hook)
  ad-Orig-read-buffer(">> " nil nil)
  (setq ad-return-value (ad-Orig-read-buffer prompt def require-match))
  (let ((completion-styles ...)) (setq ad-return-value (ad-Orig-read-buffer 
prompt def require-match)))
  (let (ad-return-value) (let (...) (setq ad-return-value ...)) ad-return-value)
  read-buffer(">> ")
  apply(read-buffer ">> " nil)
  (save-window-excursion (apply read-fn lusty-prompt args))
  (unwind-protect (save-window-excursion (apply read-fn lusty-prompt args)) 
(remove-hook (quote post-command-hook) (quote lusty--post-command-function)) 
(setq lusty--previous-minibuffer-contents nil lusty--initial-window-config nil 
lusty--current-idle-timer nil))
  (let ((lusty--highlighted-coords ...) (lusty--matches-matrix ...) 
(lusty--matrix-column-widths ...) (lusty--matrix-truncated-p nil)) (add-hook 
(quote post-command-hook) (quote lusty--post-command-function) t) 
(unwind-protect (save-window-excursion ...) (remove-hook ... ...) (setq 
lusty--previous-minibuffer-contents nil lusty--initial-window-config nil 
lusty--current-idle-timer nil)))
  lusty--run(read-buffer)
  (let* ((lusty--active-mode :buffer-explorer) (minibuffer-local-completion-map 
lusty-mode-map) (buffer ...)) (when buffer (switch-to-buffer buffer)))
  lusty-buffer-explorer()
  call-interactively(lusty-buffer-explorer nil nil)
--8<---------------cut here---------------end--------------->8---

Well, that doesn't help me, right?  The error message was printed
anyway, and the backtrace is the backtrace after leaving
`lusty--post-command-function'.

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]