From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#9463: 24.0.50; Errors should not be continuable Date: Sat, 10 Sep 2011 20:27:22 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315679282 30355 80.91.229.12 (10 Sep 2011 18:28:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Sep 2011 18:28:02 +0000 (UTC) To: 9463@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 10 20:27:56 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2SHT-0005Th-RM for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Sep 2011 20:27:56 +0200 Original-Received: from localhost ([::1]:39181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHT-0003cm-CU for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Sep 2011 14:27:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHQ-0003ch-6a for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2SHP-0005Kj-7Y for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHP-0005Kf-4l for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R2SLS-0007oY-19; Sat, 10 Sep 2011 14:32:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Helmut Eller Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Sep 2011 18:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.131567951430024 (code B ref -1); Sat, 10 Sep 2011 18:32:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Sep 2011 18:31:54 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2SLJ-0007oD-Sw for submit@debbugs.gnu.org; Sat, 10 Sep 2011 14:31:54 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R2SLH-0007o5-7Z for submit@debbugs.gnu.org; Sat, 10 Sep 2011 14:31:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2SHC-0005Js-UH for submit@debbugs.gnu.org; Sat, 10 Sep 2011 14:27:39 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:53804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHC-0005Jl-SZ for submit@debbugs.gnu.org; Sat, 10 Sep 2011 14:27:38 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHB-0003YC-Il for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2SHA-0005JA-Km for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:37 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:41806) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2SHA-0005J3-Aj for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 14:27:36 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R2SH9-0005Mp-9X for bug-gnu-emacs@gnu.org; Sat, 10 Sep 2011 20:27:35 +0200 Original-Received: from dial-176163.pool.broadband44.net ([212.46.176.163]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Sep 2011 20:27:35 +0200 Original-Received: from eller.helmut by dial-176163.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Sep 2011 20:27:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 96 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dial-176163.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:WaESvysHGwh+7xoFHg+Qh5Fy0wE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 10 Sep 2011 14:32:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50788 Archived-At: * 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."