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