I've hit a problem that region is deactivated (in transient-mark-mode). The function deactivate-mark
is called and I would like to find out where (and why) it is called from.
I tried M-x debug-on-entry RET deactivate-mark
and it stops but I found no way to find out the caller. Whole displayed stacktrace is:
Debugger entered--entering a function:
* deactivate-mark()
I tried M-x edebug-eval-defun
but Edebug does not show the caller either.
How do I find out why (where from) deactivate-mark
is called? I'm look for backtrace or stacktrace functinality.
EDIT:
An advice-add
trick:
(defun message-show-backtrace ()
(message "%s" (backtrace-frame 10)))
(advice-add deactivate-mark :before #'message-show-backtrace)
produces nil
in *Messages*
.
Edit: more info about deactivate-mark
: http://emacshorrors.com/posts/deactivate-mark.html
emacs -Q
, turn on the debugM-x debug-on-entry deactivate-mark
, activate markC-<SPC>
, type a character. – Andrew Swann May 08 '15 at 14:10deactiveate-mark
and in your advice function usebacktrace-frames
to get a view of the whole call stack if edebug is not showing what you expect. – Jordon Biondo May 08 '15 at 16:08advice-add
andbacktrace-frame
. It did not help. – Gracjan Polak May 09 '15 at 06:29self-insert-command
and "self-insert-command is an interactive built-in function in 'C source code'." This, together with the other behavior noted so far, suggests that one will have to debug withgdb
. – Joe Corneli May 29 '15 at 22:05advice-add
contains a syntax error: thedeactivate-mark
should be'deactivate-mark
. Also,backtrace-frame
for me seems to just returnnil
, Idk why. Instead(backtrace)
works more or less, except that it prints to*Messages*
instead of returning a string. There's this answer though that describes how to make(backtrace)
return a string. – Hi-Angel Mar 27 '24 at 22:50