* How to stop all edebug?
@ 2019-10-23 4:56 Zhang Haijun
2019-10-23 6:46 ` Michael Heerdegen
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Zhang Haijun @ 2019-10-23 4:56 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
I edebug(use edebug-defun) some functions in file.el and then close file.el. When I open a new file, emacs aborts and show a buffer with edebug error(It can’t find the original buffer to debug).
And I event can’t quit emacs because there are functions in kill-emacs-hook which try to open file and save data(such as recentf).
Is it possible to cleanup all edebug sessions?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-23 4:56 How to stop all edebug? Zhang Haijun
@ 2019-10-23 6:46 ` Michael Heerdegen
[not found] ` <mailman.1523.1571813205.9715.help-gnu-emacs@gnu.org>
2019-10-24 4:10 ` HaiJun Zhang
2019-10-23 12:43 ` Stefan Monnier
2019-10-23 15:21 ` Eli Zaretskii
2 siblings, 2 replies; 14+ messages in thread
From: Michael Heerdegen @ 2019-10-23 6:46 UTC (permalink / raw)
To: Zhang Haijun; +Cc: help-gnu-emacs@gnu.org
Zhang Haijun <ccsmile2008@outlook.com> writes:
> I edebug(use edebug-defun) some functions in file.el and then close
> file.el. When I open a new file, emacs aborts and show a buffer with
> edebug error(It can’t find the original buffer to debug).
>
> And I event can’t quit emacs because there are functions in
> kill-emacs-hook which try to open file and save data(such as recentf).
>
> Is it possible to cleanup all edebug sessions?
There has been a commit to the master branch some days ago that makes
`cancel-edebug-on-entry' do that by default (confirm with an empty
prompt). If you don't use the master branch, this is the code that does
what you want:
(dolist (function (edebug--edebug-on-entry-functions))
(put function 'edebug-on-entry nil))
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <mailman.1523.1571813205.9715.help-gnu-emacs@gnu.org>]
* Re: How to stop all edebug?
[not found] ` <mailman.1523.1571813205.9715.help-gnu-emacs@gnu.org>
@ 2019-10-23 7:31 ` Lars Magne Ingebrigtsen
2019-10-24 11:09 ` Michael Heerdegen
0 siblings, 1 reply; 14+ messages in thread
From: Lars Magne Ingebrigtsen @ 2019-10-23 7:31 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
Michael Heerdegen <michael_heerdegen@web.de> writes:
> There has been a commit to the master branch some days ago that makes
> `cancel-edebug-on-entry' do that by default (confirm with an empty
> prompt). If you don't use the master branch, this is the code that does
> what you want:
>
> (dolist (function (edebug--edebug-on-entry-functions))
> (put function 'edebug-on-entry nil))
That doesn't remove the edebugging, though -- it just removes the "stop"
instrumentation on those functions. (So edebug-on-entry isn't analogous
to debug-on-entry, confusingly enough.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-23 7:31 ` Lars Magne Ingebrigtsen
@ 2019-10-24 11:09 ` Michael Heerdegen
0 siblings, 0 replies; 14+ messages in thread
From: Michael Heerdegen @ 2019-10-24 11:09 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
Lars Magne Ingebrigtsen <lmi@gnus.org> writes:
> > (dolist (function (edebug--edebug-on-entry-functions))
> > (put function 'edebug-on-entry nil))
>
> That doesn't remove the edebugging, though -- it just removes the "stop"
> instrumentation on those functions. (So edebug-on-entry isn't analogous
> to debug-on-entry, confusingly enough.)
Yes, and you already have added a command
`edebug-remove-instrumentation' ("Remove Edebug instrumentation from all
functions.") to master 4 days ago which does the other part.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-23 6:46 ` Michael Heerdegen
[not found] ` <mailman.1523.1571813205.9715.help-gnu-emacs@gnu.org>
@ 2019-10-24 4:10 ` HaiJun Zhang
2019-10-24 11:05 ` Michael Heerdegen
1 sibling, 1 reply; 14+ messages in thread
From: HaiJun Zhang @ 2019-10-24 4:10 UTC (permalink / raw)
To: Zhang Haijun, Michael Heerdegen; +Cc: help-gnu-emacs@gnu.org
在 2019年10月23日 +0800 PM2:47,Michael Heerdegen <michael_heerdegen@web.de>,写道:
If you don't use the master branch, this is the code that does
what you want:
(dolist (function (edebug--edebug-on-entry-functions))
(put function 'edebug-on-entry nil))
I eval the form. Emacs(26.3 on macOS) shows error like this:
Debugger entered--Lisp error: (void-function edebug--edebug-on-entry-functions)
(edebug--edebug-on-entry-functions)
(let ((--dolist-tail-- (edebug--edebug-on-entry-functions)) function) (while --dolist-tail-- (setq function (car --dolist-tail--)) (put function (quote edebug-on-entry) nil) (setq --dolist-tail-- (cdr --dolist-tail--))))
eval((let ((--dolist-tail-- (edebug--edebug-on-entry-functions)) function) (while --dolist-tail-- (setq function (car --dolist-tail--)) (put function (quote edebug-on-entry) nil) (setq --dolist-tail-- (cdr --dolist-tail--)))) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-24 4:10 ` HaiJun Zhang
@ 2019-10-24 11:05 ` Michael Heerdegen
2019-10-24 12:45 ` HaiJun Zhang
[not found] ` <70a705e7-cebf-4ac4-b7af-0fc04b383de6@Spark>
0 siblings, 2 replies; 14+ messages in thread
From: Michael Heerdegen @ 2019-10-24 11:05 UTC (permalink / raw)
To: HaiJun Zhang; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
HaiJun Zhang <netjune@outlook.com> writes:
> 在 2019年10月23日 +0800 PM2:47,Michael Heerdegen
> <michael_heerdegen@web.de>,写道:
> If you don't use the master branch, this is the code that does
> what you want:
>
> (dolist (function (edebug--edebug-on-entry-functions))
> (put function 'edebug-on-entry nil))
>
> I eval the form. Emacs(26.3 on macOS) shows error like this:
Correct - my mistake. The missing function had been added in the same
commit some days ago. Here it is the complete code:
#+begin_src emacs-lisp
(defun edebug--edebug-on-entry-functions ()
(let ((functions nil))
(mapatoms
(lambda (symbol)
(when (and (fboundp symbol)
(get symbol 'edebug-on-entry))
(push symbol functions)))
obarray)
functions))
(dolist (function (edebug--edebug-on-entry-functions))
(put function 'edebug-on-entry nil))
#+end_src
That should work now.
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-24 11:05 ` Michael Heerdegen
@ 2019-10-24 12:45 ` HaiJun Zhang
2019-10-24 13:13 ` Michael Heerdegen
[not found] ` <70a705e7-cebf-4ac4-b7af-0fc04b383de6@Spark>
1 sibling, 1 reply; 14+ messages in thread
From: HaiJun Zhang @ 2019-10-24 12:45 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
在 2019年10月24日 +0800 PM7:05,Michael Heerdegen <michael_heerdegen@web.de>,写道:
Correct - my mistake. The missing function had been added in the same
commit some days ago. Here it is the complete code:
#+begin_src emacs-lisp
(defun edebug--edebug-on-entry-functions ()
(let ((functions nil))
(mapatoms
(lambda (symbol)
(when (and (fboundp symbol)
(get symbol 'edebug-on-entry))
(push symbol functions)))
obarray)
functions))
(dolist (function (edebug--edebug-on-entry-functions))
(put function 'edebug-on-entry nil))
#+end_src
That should work now.
I tried and it didn’t work. I eval `(edebug--edebug-on-entry-functions)` and it returns nil.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-24 12:45 ` HaiJun Zhang
@ 2019-10-24 13:13 ` Michael Heerdegen
2019-10-24 14:10 ` HaiJun Zhang
0 siblings, 1 reply; 14+ messages in thread
From: Michael Heerdegen @ 2019-10-24 13:13 UTC (permalink / raw)
To: HaiJun Zhang; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
HaiJun Zhang <netjune@outlook.com> writes:
> I tried and it didn’t work. I eval
> `(edebug--edebug-on-entry-functions)` and it returns nil.
Oh well, correct again, that doesn't work as well, sorry for wasting
your time.
Ok, now I have tested that Lars' new `edebug-remove-instrumentation':
#+begin_src emacs-lisp
(defun edebug-remove-instrumentation ()
"Remove Edebug instrumentation from all functions."
(interactive)
(let ((functions nil))
(mapatoms
(lambda (symbol)
(when (and (functionp symbol)
(get symbol 'edebug))
(let ((unwrapped (edebug-unwrap* (symbol-function symbol))))
(unless (equal unwrapped (symbol-function symbol))
(push symbol functions)
(setf (symbol-function symbol) unwrapped)))))
obarray)
(if (not functions)
(message "Found no functions to remove instrumentation from")
(message "Remove edebug instrumentation from %s"
(mapconcat #'symbol-name functions ", ")))))
#+end_src
works for me at least in 26.1. Can you please try that? Just M-x
edebug-remove-instrumentation.
Regards,
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-24 13:13 ` Michael Heerdegen
@ 2019-10-24 14:10 ` HaiJun Zhang
0 siblings, 0 replies; 14+ messages in thread
From: HaiJun Zhang @ 2019-10-24 14:10 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs@gnu.org, Zhang Haijun
在 2019年10月24日 +0800 PM9:13,Michael Heerdegen <michael_heerdegen@web.de>,写道:
HaiJun Zhang <netjune@outlook.com> writes:
I tried and it didn’t work. I eval
`(edebug--edebug-on-entry-functions)` and it returns nil.
Oh well, correct again, that doesn't work as well, sorry for wasting
your time.
Ok, now I have tested that Lars' new `edebug-remove-instrumentation':
#+begin_src emacs-lisp
(defun edebug-remove-instrumentation ()
"Remove Edebug instrumentation from all functions."
(interactive)
(let ((functions nil))
(mapatoms
(lambda (symbol)
(when (and (functionp symbol)
(get symbol 'edebug))
(let ((unwrapped (edebug-unwrap* (symbol-function symbol))))
(unless (equal unwrapped (symbol-function symbol))
(push symbol functions)
(setf (symbol-function symbol) unwrapped)))))
obarray)
(if (not functions)
(message "Found no functions to remove instrumentation from")
(message "Remove edebug instrumentation from %s"
(mapconcat #'symbol-name functions ", ")))))
#+end_src
works for me at least in 26.1. Can you please try that? Just M-x
edebug-remove-instrumentation.
Regards,
Michael.
I tried. It works in 26.3.
Thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <70a705e7-cebf-4ac4-b7af-0fc04b383de6@Spark>]
* Re: How to stop all edebug?
2019-10-23 4:56 How to stop all edebug? Zhang Haijun
2019-10-23 6:46 ` Michael Heerdegen
@ 2019-10-23 12:43 ` Stefan Monnier
2019-10-24 4:12 ` HaiJun Zhang
2019-10-23 15:21 ` Eli Zaretskii
2 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2019-10-23 12:43 UTC (permalink / raw)
To: help-gnu-emacs
> I edebug(use edebug-defun) some functions in file.el and then close
> file.el. When I open a new file, emacs aborts and show a buffer with edebug
> error(It can’t find the original buffer to debug).
>
> And I event can’t quit emacs because there are functions in kill-emacs-hook
> which try to open file and save data(such as recentf).
Could you make a bug report for that?
If the source buffer is not available any more (as in your case above),
it's OK for Edebug to complain loudly, but it shouldn't prevent you from
using Emacs normally enough to exit or restore sanity.
E.g. after "aborts and show a buffer with edebug error" it could/should
offer to either cancel the "edebug on entry" or to de-instrument the function.
Stefan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to stop all edebug?
2019-10-23 4:56 How to stop all edebug? Zhang Haijun
2019-10-23 6:46 ` Michael Heerdegen
2019-10-23 12:43 ` Stefan Monnier
@ 2019-10-23 15:21 ` Eli Zaretskii
2019-10-24 4:16 ` HaiJun Zhang
2 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2019-10-23 15:21 UTC (permalink / raw)
To: help-gnu-emacs
> From: Zhang Haijun <ccsmile2008@outlook.com>
> Date: Wed, 23 Oct 2019 04:56:28 +0000
>
> I edebug(use edebug-defun) some functions in file.el and then close file.el. When I open a new file, emacs aborts and show a buffer with edebug error(It can’t find the original buffer to debug).
>
> And I event can’t quit emacs because there are functions in kill-emacs-hook which try to open file and save data(such as recentf).
>
> Is it possible to cleanup all edebug sessions?
I usually "M-x load-library" each file where I instrumented some
functions.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-10-24 14:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23 4:56 How to stop all edebug? Zhang Haijun
2019-10-23 6:46 ` Michael Heerdegen
[not found] ` <mailman.1523.1571813205.9715.help-gnu-emacs@gnu.org>
2019-10-23 7:31 ` Lars Magne Ingebrigtsen
2019-10-24 11:09 ` Michael Heerdegen
2019-10-24 4:10 ` HaiJun Zhang
2019-10-24 11:05 ` Michael Heerdegen
2019-10-24 12:45 ` HaiJun Zhang
2019-10-24 13:13 ` Michael Heerdegen
2019-10-24 14:10 ` HaiJun Zhang
[not found] ` <70a705e7-cebf-4ac4-b7af-0fc04b383de6@Spark>
2019-10-24 13:12 ` HaiJun Zhang
2019-10-23 12:43 ` Stefan Monnier
2019-10-24 4:12 ` HaiJun Zhang
2019-10-23 15:21 ` Eli Zaretskii
2019-10-24 4:16 ` HaiJun Zhang
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).