all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Helmut Eller <eller.helmut@gmail.com>
To: 9463@debbugs.gnu.org
Subject: bug#9463: 24.0.50; Errors should not be continuable
Date: Sat, 10 Sep 2011 20:27:22 +0200	[thread overview]
Message-ID: <m2ty8kgsmt.fsf@gmail.com> (raw)
In-Reply-To: <m2sjo71bvo.fsf@gmail.com>

* Stefan Monnier [2011-09-09 21:44] writes:

>> Specifically, I'm saying that c should not unwind the stack after
>> errors.
>
> I understand that's what you want.  The fixes I installed in the C side
> were done to make it possible for "c" to continue after an error, which
> is a very useful behavior in several cases.  So I'm definitely not going
> to revert this change.
>
> What I can offer is to provide more flexibility so you could for
> instance rebind "c" to some command that simulates the behavior you used
> to get with "c".  We could also consider changing "c" so it asks for
> confirmation before continuing from an error.
>
> But for any of that, we first have to change the code so that "c" can
> know whether we were called because of an error or not: currently "c"
> doesn't known that (and it didn't know that either in earlier Emacsen).

The patch below is what I think that the debugger should do.
Incidentally, C-M-c does pretty much the same as what c does currently.
So, no new command to get the current behavior would be needed.


=== modified file 'lisp/emacs-lisp/debug.el'
--- lisp/emacs-lisp/debug.el	2011-08-22 21:16:46 +0000
+++ lisp/emacs-lisp/debug.el	2011-09-10 18:23:13 +0000
@@ -98,6 +98,9 @@
 
 (defvar inhibit-trace)                  ;Not yet implemented.
 
+(defvar debugger-args nil
+  "Arguments passed to `debug'.")
+
 ;;;###autoload
 (setq debugger 'debug)
 ;;;###autoload
@@ -419,15 +422,27 @@
   (message "Proceeding, will debug on next eval or call.")
   (exit-recursive-edit))
 
+(defun debugger-continuable-p ()
+  "Can we reasonably continue from the current situation?"
+  (and debugger-may-continue
+       (not (eq (car debugger-args)
+		'error))))
+
 (defun debugger-continue ()
   "Continue, evaluating this expression without stopping."
   (interactive)
-  (unless debugger-may-continue
-    (error "Cannot continue"))
-  (message "Continuing.")
+  (cond ((debugger-condition-continuable-p)
+	 (message "Continuing.")
+	 (debugger-exit-recursive-edit))
+	(t
+	 (message "Cannot continue")
+	 (ding))))
+
+(defun debugger-exit-recursive-edit ()
+  ;; Exit but first check if we've flagged some frame for
+  ;; debug-on-exit, in which case we'll probably come back to the
+  ;; debugger soon.
   (save-excursion
-    ;; Check to see if we've flagged some frame for debug-on-exit, in which
-    ;; case we'll probably come back to the debugger soon.
     (goto-char (point-min))
     (if (re-search-forward "^\\* " nil t)
         (setq debugger-will-be-back t)))
@@ -438,16 +453,14 @@
 This is only useful when the value returned from the debugger
 will be used, such as in a debug on exit from a frame."
   (interactive "XReturn value (evaluated): ")
-  (setq debugger-value val)
-  (princ "Returning " t)
-  (prin1 debugger-value)
-  (save-excursion
-    ;; Check to see if we've flagged some frame for debug-on-exit, in which
-    ;; case we'll probably come back to the debugger soon.
-    (goto-char (point-min))
-    (if (re-search-forward "^\\* " nil t)
-        (setq debugger-will-be-back t)))
-  (exit-recursive-edit))
+  (cond ((debugger-condition-continuable-p)
+	 (setq debugger-value val)
+	 (princ "Returning " t)
+	 (prin1 debugger-value)
+	 (debugger-exit-recursive-edit))
+	(t
+	 (message "Cannot return")
+	 (ding))))
 
 (defun debugger-jump ()
   "Continue to exit from this frame, with all debug-on-entry suspended."







  reply	other threads:[~2011-09-10 18:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-08 12:01 bug#9463: 24.0.50; Errors should not be continuable Helmut Eller
2011-09-08 13:31 ` Stefan Monnier
2011-09-08 18:13   ` Helmut Eller
2011-09-09  2:23     ` Stefan Monnier
2011-09-09  6:53       ` Helmut Eller
2011-09-09 14:07         ` Stefan Monnier
2011-09-09 16:37           ` Helmut Eller
2011-09-09 21:44             ` Stefan Monnier
2011-09-10 18:27               ` Helmut Eller [this message]
2011-09-19 21:17                 ` Stefan Monnier
2011-09-20  6:49                   ` Helmut Eller
2011-09-20 21:53                     ` Stefan Monnier
2011-09-21  8:05                       ` Helmut Eller
2011-09-21 19:09                         ` Stefan Monnier
2011-09-21 19:53                           ` Helmut Eller
2012-02-22  2:20                             ` Glenn Morris
2011-09-09  7:10       ` Eli Zaretskii
2011-09-09  7:36         ` Helmut Eller
2011-09-09  7:59           ` Eli Zaretskii
2011-09-09  8:22             ` Helmut Eller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ty8kgsmt.fsf@gmail.com \
    --to=eller.helmut@gmail.com \
    --cc=9463@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.