I work a lot with Asciidoc in emacs (adoc-mode
). I believe it has a bug that occurs when editing inlined source code. What happens is emacs freezes, CPU consumption goes to 100%. I can reproduce this behaviour easily.
How do I actually establish what script is causing emacs to hang like that?? And preferably produce a backtrace?
Since emacs freezes while typing within the buffer, rather than after executing a command, stuff like
toggle-debug-on-quit
or debug-on-entry
are useless.
I suppose I could mark every single defun
in adoc-mode.el
with printf
s, but I'm hoping there's an easier way :)
EDIT:
So, I ended up grep
ping my ~/.emacs.d/lisp
for ALL defun
s and trace-function
each one.
I was able to narrow down the problem and created a small test case.
These 3 files are required:
$ find /home/victor/.emacs.d/
/home/victor/.emacs.d/
/home/victor/.emacs.d/lisp
/home/victor/.emacs.d/lisp/doc-mode.el
/home/victor/.emacs.d/lisp/adoc-mode.el
/home/victor/.emacs.d/lisp/markup-faces.el
My .emacs
:
$ cat .emacs
(setq inhibit-startup-message t)
(add-to-list 'load-path "~/.emacs.d/lisp/")
(require 'adoc-mode)
(switch-to-buffer (find-file "test.doc"))
(adoc-mode)
(goto-char 29)
(delete-backward-char 5)
;; now (adoc-kwf-attriblist) is in endless loop!!
And the testcase is (word "shell" is deleted by elisp):
$ cat test.doc
blah blah blah
[source,shell]
foo
bar
Now, run emacs
and it will hang in (adoc-kwf-attriblist)
. I don't know much about emacs programming, but seems this thing does not eventually move the point to end
position.
(goto-char (or (text-property-not-all (point) end 'adoc-attribute-list nil)
end))
C-g
? – François Févotte