unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* debugging post command hook max-lisp-eval-depth
@ 2018-06-17 17:34 John Shahid
  2018-06-17 19:16 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: John Shahid @ 2018-06-17 17:34 UTC (permalink / raw)
  To: Help GNU Emacs

Hi all,

every now and then my Emacs will get in a bad state because of some
infinite recursion in the post-command-hook. I am reaching out for ideas
on how to debug Emacs when it gets into this weird state. Keep in mind
that it is hard to do anything with Emacs at that point since any
command (switching buffer, starting debugger) will fail with the same
error `Lisp nesting exceeds...'.

I don't know when this started happening and can't easily debug/bisect
my configuration since this situation happens rarely and intermittently
(2 or 3 times last week).

What I currently have is the following post-command-hook in init.el (not
sure how useful it will be) to stop the infinite recursion:

    (defvar debug-post-command-hook-count nil)

    (defun debug-post-command-hook ()
      (let ((debug-post-command-hook-count (1+ (or debug-post-command-hook-count 0))))
        (if (> debug-post-command-hook-count 10)
            (debug)
          (print (format "post-command-hook %d %S"
                         debug-post-command-hook-count
                         (current-buffer))
                 #'external-debugging-output))))

    (add-hook 'post-command-hook #'debug-post-command-hook)

I also compiled emacs with no optimization and debug symbols (using info
in etc/DEBUG) and planning to use `xbacktrace' when I run into that
situation.

Do you have any other ideas to prepare me for when this happens again ?

p.s. my emacs version is "4a7e74fea687011ee81dcbb02294bccd99b3a05f". I
tried to use the latest commit but ran into weird issues during
redisplay (where Emacs would end up in die()) and autocompletion (where
the candidates left edge isn't lined up properly), but I decided to
ignore those issues for now and stick with the previous revision.

-js



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

end of thread, other threads:[~2018-06-23 15:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-17 17:34 debugging post command hook max-lisp-eval-depth John Shahid
2018-06-17 19:16 ` Stefan Monnier
2018-06-17 23:27   ` John Shahid
2018-06-18 14:03     ` Stefan Monnier
2018-06-18 16:33       ` John Shahid
2018-06-18 16:53         ` Stefan Monnier
2018-06-18 18:10           ` John Shahid
2018-06-20 19:31             ` John Shahid
2018-06-20 21:53               ` Stefan Monnier
2018-06-22  4:38                 ` Leo Liu
2018-06-23 15:15                   ` John Shahid

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).