From unknown Sun Jun 15 08:24:03 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#47677 <47677@debbugs.gnu.org> To: bug#47677 <47677@debbugs.gnu.org> Subject: Status: [PATCH] condition-case success continuation Reply-To: bug#47677 <47677@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:24:03 +0000 retitle 47677 [PATCH] condition-case success continuation reassign 47677 emacs submitter 47677 Mattias Engdeg=C3=A5rd severity 47677 wishlist tag 47677 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 09 16:27:03 2021 Received: (at submit) by debbugs.gnu.org; 9 Apr 2021 20:27:03 +0000 Received: from localhost ([127.0.0.1]:51024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUxiZ-0002ZG-8H for submit@debbugs.gnu.org; Fri, 09 Apr 2021 16:27:03 -0400 Received: from lists.gnu.org ([209.51.188.17]:53902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lUxiY-0002Yx-42 for submit@debbugs.gnu.org; Fri, 09 Apr 2021 16:27:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUxiX-00042T-QD for bug-gnu-emacs@gnu.org; Fri, 09 Apr 2021 16:27:01 -0400 Received: from mail200c50.megamailservers.eu ([91.136.10.210]:36946 helo=mail193c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUxiV-0006UZ-C3 for bug-gnu-emacs@gnu.org; Fri, 09 Apr 2021 16:27:01 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1618000012; bh=7V7CaYsY/HLO0NLw6nrj1l/2qpEOZPVaAS49V8kf90c=; h=From:Subject:Date:To:From; b=kD65qy1UlWQqaMw0GhbKNB9WA2yyrnApCCA4MqomK//YU3ggVkz52Y9MBGHZU326V KQe18xzmAMvL81vgyRPMraCG+62cWBxlmDp92trTTBut6KG+aMsdUymt8GAz1vYFYs nFZ0kyKT2kUWnCrFbxkUe68kSvt4GF6TxcHYhBo4= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 139KQoVd019846 for ; Fri, 9 Apr 2021 20:26:51 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_2A1C3F29-9A56-4B7B-9D7A-3BD0DCF89340" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: [PATCH] condition-case success continuation Message-Id: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> Date: Fri, 9 Apr 2021 22:26:49 +0200 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1D.6070B88B.0069, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=PqLtkDE3 c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=M51BFTxLslgA:10 a=yqP2UuPKgrWxpfcNVlMA:9 a=CjuIK1q_8ugA:10 a=mGGVe17ArwRYEn8pBrIA:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.210; envelope-from=mattiase@acm.org; helo=mail193c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Apple-Mail=_2A1C3F29-9A56-4B7B-9D7A-3BD0DCF89340 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii This patch adds the condition-case handler syntax (:success BODY) for code executed when the protected form terminates without error. BODY = is then executed with the variable bound to the result of the protected = form, and the result of BODY is then the value of the condition-case = form as usual. This plugs an annoying hole in elisp: there hasn't been any direct = access to the success continuation which forced programmers to resort to = various hacks such as tagging the returned value and then immediately = testing that tag, as in (let ((input (condition-case _ (cons 'ok (read buffer)) (end-of-file 'eof)))) (when (consp input) (use (cdr input)))) Now we can write (condition-case result (read buffer) (end-of-file 'eof) (:success (use result))) which is more concise, elegant and performant. Like all condition-case handlers (but in contrast to the protected = form), the success handler is in the tail position and the limited = self-tail-recursion of cl-labels (and named-let) works there as = expected. Details of the syntax can be changed if there is a very good reason for = it. Many other languages have more or less independently added = equivalent constructs. Common Lisp's `handler-case` has a very similar = feature (:no-error). It would be nice to give `catch` the same treatment. A particularly = flexible solution would be to add `catch` handlers to `condition-case`, = which would then be able to handle everything. Unless there is a strong = reason for doing it right away, it can be seen as a later improvement. --Apple-Mail=_2A1C3F29-9A56-4B7B-9D7A-3BD0DCF89340 Content-Disposition: attachment; filename=0001-Add-condition-case-success-handler.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-condition-case-success-handler.patch" Content-Transfer-Encoding: quoted-printable =46rom=20952fc7ea3878d3d71a82d669a1499aee0d1f8c55=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=207=20Apr=202021=2011:31:07=20+0200=0A= Subject:=20[PATCH]=20Add=20condition-case=20success=20handler=0A=0AAllow=20= a=20condition-case=20handler=20on=20the=20form=20(:success=20BODY)=20to=20= be=0Aspecified=20as=20the=20success=20continuation=20of=20the=20= protected=20form,=20with=0Athe=20specified=20variable=20bound=20to=20its=20= result.=0A=0A*=20src/eval.c=20(Fcondition_case):=20Update=20the=20doc=20= string.=0A(internal_lisp_condition_case):=20Implement=20in=20= interpreter.=0A(syms_of_eval):=20Defsym=20:success.=0A*=20= lisp/emacs-lisp/bytecomp.el=20(byte-compile-condition-case):=0AImplement=20= in=20byte-compiler.=0A*=20lisp/emacs-lisp/cl-macs.el=20(cl--self-tco):=20= Allow=20self-TCO=0Afrom=20success=20handler.=0A*=20= doc/lispref/control.texi=20(Handling=20Errors):=20Update=20manual.=0A*=20= etc/NEWS:=20Announce.=0A*=20test/lisp/emacs-lisp/bytecomp-tests.el=20= (bytecomp-tests--test-cases)=0A(bytecomp-condition-case-success):=0A*=20= test/lisp/emacs-lisp/cl-macs-tests.el=20(cl-macs--labels):=0AAdd=20test=20= cases.=0A---=0A=20doc/lispref/control.texi=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20|=20=209=20++-=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=205=20= ++=0A=20lisp/emacs-lisp/bytecomp.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= 28=20++++++++-=0A=20lisp/emacs-lisp/cl-macs.el=20=20=20=20=20=20=20=20=20= =20=20=20=20|=20=204=20+-=0A=20src/eval.c=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2034=20= ++++++++++-=0A=20test/lisp/emacs-lisp/bytecomp-tests.el=20|=2078=20= ++++++++++++++++++++++++++=0A=20test/lisp/emacs-lisp/cl-macs-tests.el=20=20= |=20=209=20+--=0A=207=20files=20changed,=20157=20insertions(+),=2010=20= deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/control.texi=20= b/doc/lispref/control.texi=0Aindex=203388102f69..22b665bc93=20100644=0A= ---=20a/doc/lispref/control.texi=0A+++=20b/doc/lispref/control.texi=0A@@=20= -2012,7=20+2012,8=20@@=20Handling=20Errors=0A=20This=20special=20form=20= establishes=20the=20error=20handlers=20@var{handlers}=20around=0A=20the=20= execution=20of=20@var{protected-form}.=20=20If=20@var{protected-form}=20= executes=0A=20without=20error,=20the=20value=20it=20returns=20becomes=20= the=20value=20of=20the=0A-@code{condition-case}=20form;=20in=20this=20= case,=20the=20@code{condition-case}=20has=0A+@code{condition-case}=20= form=20(in=20the=20absence=20of=20a=20success=20handler;=20see=20below).=0A= +In=20this=20case,=20the=20@code{condition-case}=20has=0A=20no=20effect.=20= =20The=20@code{condition-case}=20form=20makes=20a=20difference=20when=20= an=0A=20error=20occurs=20during=20@var{protected-form}.=0A=20=0A@@=20= -2062,6=20+2063,12=20@@=20Handling=20Errors=0A=20If=20@var{var}=20is=20= @code{nil},=20that=20means=20no=20variable=20is=20bound.=20=20Then=20the=0A= =20error=20symbol=20and=20associated=20data=20are=20not=20available=20to=20= the=20handler.=0A=20=0A+@cindex=20success=20handler=0A+As=20a=20special=20= case,=20one=20of=20the=20@var{handlers}=20can=20be=20a=20list=20of=20the=0A= +form=20@code{(:success=20@var{body}@dots{})},=20where=20@var{body}=20is=20= executed=0A+with=20@var{var}=20(if=20non-@code{nil})=20bound=20to=20the=20= return=20value=20of=0A+@var{protected-form}=20when=20that=20expression=20= terminates=20without=20error.=0A+=0A=20@cindex=20rethrow=20a=20signal=0A=20= Sometimes=20it=20is=20necessary=20to=20re-throw=20a=20signal=20caught=20= by=0A=20@code{condition-case},=20for=20some=20outer-level=20handler=20to=20= catch.=20=20Here's=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= a0f05d8cf1..fa82e2872f=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-2898,6=20+2898,11=20@@=20arrays=20nor=20objects.=0A=20The=20= special=20events=20'dbus-event'=20and=20'file-notify'=20are=20now=20= ignored=20in=0A=20'while-no-input'=20when=20added=20to=20this=20= variable.=0A=20=0A++++=0A+**=20'condition-case'=20now=20allows=20for=20a=20= success=20handler.=0A+It=20is=20executed=20whenever=20the=20protected=20= form=20terminates=20without=20error,=0A+with=20the=20specified=20= variable=20bound=20to=20the=20returned=20value.=0A+=0A=20=0C=0A=20*=20= Changes=20in=20Emacs=2028.1=20on=20Non-Free=20Operating=20Systems=0A=20=0A= diff=20--git=20a/lisp/emacs-lisp/bytecomp.el=20= b/lisp/emacs-lisp/bytecomp.el=0Aindex=200babbbb978..ce3a759487=20100644=0A= ---=20a/lisp/emacs-lisp/bytecomp.el=0A+++=20= b/lisp/emacs-lisp/bytecomp.el=0A@@=20-4621,10=20+4621,15=20@@=20= byte-compile-unwind-protect=0A=20(defun=20byte-compile-condition-case=20= (form)=0A=20=20=20(let*=20((var=20(nth=201=20form))=0A=20=20=20=20=20=20=20= =20=20=20(body=20(nth=202=20form))=0A+=20=20=20=20=20=20=20=20=20= (handlers=20(nthcdr=203=20form))=0A=20=20=20=20=20=20=20=20=20=20(depth=20= byte-compile-depth)=0A+=20=20=20=20=20=20=20=20=20(success-handler=20= (assq=20:success=20handlers))=0A+=20=20=20=20=20=20=20=20=20= (failure-handlers=20(if=20success-handler=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(remq=20= success-handler=20handlers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20handlers))=0A=20=20=20=20=20= =20=20=20=20=20(clauses=20(mapcar=20(lambda=20(clause)=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (cons=20(byte-compile-make-tag)=20clause))=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(nthcdr=203=20form)))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20failure-handlers))=0A=20=20=20=20=20=20=20=20=20=20(endtag=20= (byte-compile-make-tag)))=0A=20=20=20=20=20= (byte-compile-set-symbol-position=20'condition-case)=0A=20=20=20=20=20= (unless=20(symbolp=20var)=0A@@=20-4650,6=20+4655,27=20@@=20= byte-compile-condition-case=0A=20=0A=20=20=20=20=20(byte-compile-form=20= body)=20;;=20byte-compile--for-effect=0A=20=20=20=20=20(dolist=20(_=20= clauses)=20(byte-compile-out=20'byte-pophandler))=0A+=0A+=20=20=20=20= (when=20success-handler=0A+=20=20=20=20=20=20(let=20((success-body=20= (cdr=20success-handler)))=0A+=20=20=20=20=20=20=20=20(cond=0A+=20=20=20=20= =20=20=20=20=20((null=20var)=0A+=20=20=20=20=20=20=20=20=20=20= (byte-compile-discard)=0A+=20=20=20=20=20=20=20=20=20=20= (byte-compile-body=20success-body=20byte-compile--for-effect))=0A+=20=20=20= =20=20=20=20=20=20(lexical-binding=0A+=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile--lexical-environment=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20byte-compile--lexical-environment))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20(push=20(cons=20var=20(1-=20byte-compile-depth))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= byte-compile--lexical-environment)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-body=20success-body=20byte-compile--for-effect)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20(byte-compile-discard=201=20'preserve-tos)))=0A= +=20=20=20=20=20=20=20=20=20(t=0A+=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile-bound-variables=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20byte-compile-bound-variables))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20(byte-compile-dynamic-variable-bind=20var)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20(byte-compile-body=20success-body=20= byte-compile--for-effect)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-out=20'byte-unbind=201))))))=0A+=0A=20=20=20=20=20= (byte-compile-goto=20'byte-goto=20endtag)=0A=20=0A=20=20=20=20=20(while=20= clauses=0Adiff=20--git=20a/lisp/emacs-lisp/cl-macs.el=20= b/lisp/emacs-lisp/cl-macs.el=0Aindex=2068211ec410..b7e5be95bc=20100644=0A= ---=20a/lisp/emacs-lisp/cl-macs.el=0A+++=20b/lisp/emacs-lisp/cl-macs.el=0A= @@=20-2144,7=20+2144,9=20@@=20cl--self-tco=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20((and=20`(condition-case=20,err-var=20,bodyform=20.=20= ,handlers)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (guard=20(not=20(eq=20err-var=20var))))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20`(condition-case=20,err-var=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(progn=20(setq=20,retvar=20,bodyform)=20nil)=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20,(if=20(assq=20:success=20= handlers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20bodyform=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20`(progn=20(setq=20,retvar=20,bodyform)=20nil))=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20.=20,(mapcar=20(lambda=20(h)=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(cons=20(car=20h)=20(funcall=20opt-exps=20(cdr=20h))))=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= handlers)))=0Adiff=20--git=20a/src/eval.c=20b/src/eval.c=0Aindex=20= ddaa8edd81..41c4cd1637=20100644=0A---=20a/src/eval.c=0A+++=20= b/src/eval.c=0A@@=20-1301,7=20+1301,7=20@@=20DEFUN=20("condition-case",=20= Fcondition_case,=20Scondition_case,=202,=20UNEVALLED,=200,=0A=20=20=20=20= =20=20=20=20doc:=20/*=20Regain=20control=20when=20an=20error=20is=20= signaled.=0A=20Executes=20BODYFORM=20and=20returns=20its=20value=20if=20= no=20error=20happens.=0A=20Each=20element=20of=20HANDLERS=20looks=20like=20= (CONDITION-NAME=20BODY...)=0A-where=20the=20BODY=20is=20made=20of=20Lisp=20= expressions.=0A+or=20(:success=20BODY),=20where=20the=20BODY=20is=20made=20= of=20Lisp=20expressions.=0A=20=0A=20A=20handler=20is=20applicable=20to=20= an=20error=20if=20CONDITION-NAME=20is=20one=20of=20the=0A=20error's=20= condition=20names.=20=20Handlers=20may=20also=20apply=20when=20non-error=0A= @@=20-1323,6=20+1323,10=20@@=20DEFUN=20("condition-case",=20= Fcondition_case,=20Scondition_case,=202,=20UNEVALLED,=200,=0A=20Then=20= the=20value=20of=20the=20last=20BODY=20form=20is=20returned=20from=20the=20= `condition-case'=0A=20expression.=0A=20=0A+The=20special=20handler=20= (:success=20BODY)=20is=20invoked=20if=20BODYFORM=20terminated=0A+without=20= signalling=20an=20error.=20=20BODY=20is=20then=20evaluated=20with=20VAR=20= bound=20to=0A+the=20value=20returned=20by=20BODYFORM.=0A+=0A=20See=20= also=20the=20function=20`signal'=20for=20more=20info.=0A=20usage:=20= (condition-case=20VAR=20BODYFORM=20&rest=20HANDLERS)=20=20*/)=0A=20=20=20= (Lisp_Object=20args)=0A@@=20-1346,16=20+1350,21=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=0A=20=20=20CHECK_SYMBOL=20(var);=0A=20=0A+=20=20= Lisp_Object=20success_handler=20=3D=20Qnil;=0A+=0A=20=20=20for=20= (Lisp_Object=20tail=20=3D=20handlers;=20CONSP=20(tail);=20tail=20=3D=20= XCDR=20(tail))=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20Lisp_Object=20= tem=20=3D=20XCAR=20(tail);=0A-=20=20=20=20=20=20clausenb++;=0A=20=20=20=20= =20=20=20if=20(!=20(NILP=20(tem)=0A=20=09=20=20=20=20=20||=20(CONSP=20= (tem)=0A=20=09=09=20&&=20(SYMBOLP=20(XCAR=20(tem))=0A=20=09=09=20=20=20=20= =20||=20CONSP=20(XCAR=20(tem))))))=0A=20=09error=20("Invalid=20condition=20= handler:=20%s",=0A=20=09=20=20=20=20=20=20=20SDATA=20(Fprin1_to_string=20= (tem,=20Qt)));=0A+=20=20=20=20=20=20if=20(EQ=20(XCAR=20(tem),=20= QCsuccess))=0A+=09success_handler=20=3D=20XCDR=20(tem);=0A+=20=20=20=20=20= =20else=0A+=09clausenb++;=0A=20=20=20=20=20}=0A=20=0A=20=20=20/*=20The=20= first=20clause=20is=20the=20one=20that=20should=20be=20checked=20first,=20= so=20it=0A@@=20-1369,7=20+1378,8=20@@=20internal_lisp_condition_case=20= (Lisp_Object=20var,=20Lisp_Object=20bodyform,=0A=20=20=20Lisp_Object=20= volatile=20*clauses=20=3D=20alloca=20(clausenb=20*=20sizeof=20*clauses);=0A= =20=20=20clauses=20+=3D=20clausenb;=0A=20=20=20for=20(Lisp_Object=20tail=20= =3D=20handlers;=20CONSP=20(tail);=20tail=20=3D=20XCDR=20(tail))=0A-=20=20= =20=20*--clauses=20=3D=20XCAR=20(tail);=0A+=20=20=20=20if=20(!EQ=20(XCAR=20= (XCAR=20(tail)),=20QCsuccess))=0A+=20=20=20=20=20=20*--clauses=20=3D=20= XCAR=20(tail);=0A=20=20=20for=20(ptrdiff_t=20i=20=3D=200;=20i=20<=20= clausenb;=20i++)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20Lisp_Object=20= clause=20=3D=20clauses[i];=0A@@=20-1409,6=20+1419,23=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=0A=20=20=20Lisp_Object=20result=20=3D=20eval_sub=20= (bodyform);=0A=20=20=20handlerlist=20=3D=20oldhandlerlist;=0A+=20=20if=20= (!NILP=20(success_handler))=0A+=20=20=20=20{=0A+=20=20=20=20=20=20if=20= (NILP=20(var))=0A+=09return=20Fprogn=20(success_handler);=0A+=0A+=20=20=20= =20=20=20Lisp_Object=20handler_var=20=3D=20var;=0A+=20=20=20=20=20=20if=20= (!NILP=20(Vinternal_interpreter_environment))=0A+=09{=0A+=09=20=20result=20= =3D=20Fcons=20(Fcons=20(var,=20result),=0A+=09=09=20=20=20=20=20=20=20= Vinternal_interpreter_environment);=0A+=09=20=20handler_var=20=3D=20= Qinternal_interpreter_environment;=0A+=09}=0A+=0A+=20=20=20=20=20=20= ptrdiff_t=20count=20=3D=20SPECPDL_INDEX=20();=0A+=20=20=20=20=20=20= specbind=20(handler_var,=20result);=0A+=20=20=20=20=20=20return=20= unbind_to=20(count,=20Fprogn=20(success_handler));=0A+=20=20=20=20}=0A=20= =20=20return=20result;=0A=20}=0A=20=0A@@=20-4381,6=20+4408,7=20@@=20= syms_of_eval=20(void)=0A=20=20=20defsubr=20(&Sthrow);=0A=20=20=20defsubr=20= (&Sunwind_protect);=0A=20=20=20defsubr=20(&Scondition_case);=0A+=20=20= DEFSYM=20(QCsuccess,=20":success");=0A=20=20=20defsubr=20(&Ssignal);=0A=20= =20=20defsubr=20(&Scommandp);=0A=20=20=20defsubr=20(&Sautoload);=0Adiff=20= --git=20a/test/lisp/emacs-lisp/bytecomp-tests.el=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0Aindex=20= 94e33a7770..3ec443e04d=20100644=0A---=20= a/test/lisp/emacs-lisp/bytecomp-tests.el=0A+++=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0A@@=20-437,6=20+437,42=20@@=20= bytecomp-tests--test-cases=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(/=201=200)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(arith-error=20x))))=0A=20=20=20=20=20=20=20(list=20x=20y))=0A+=0A+=20= =20=20=20;;=20No=20error,=20no=20success=20handler.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20;;=20Error,=20no=20= success=20handler.=0A+=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20= =20=20(/=201=200)=0A+=20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20= =20=20=20;;=20No=20error,=20success=20handler.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(cons=20= 'good=20x)))=0A+=20=20=20=20;;=20Error,=20success=20handler.=0A+=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20= =20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20= (cons=20'good=20x)))=0A+=20=20=20=20;;=20Verify=20that=20the=20success=20= code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(/=20= (car=20x)=200)))=0A+=20=20=20=20;;=20Check=20variable=20scoping=20on=20= success.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20= =20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20=20= (:success=20(list=20'good=20x))))=0A+=20=20=20=20;;=20Check=20variable=20= scoping=20on=20failure.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20= =20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20= =20(:success=20(list=20'good=20x))))=0A=20=20=20=20=20)=0A=20=20=20"List=20= of=20expressions=20for=20cross-testing=20interpreted=20and=20compiled=20= code.")=0A=20=0A@@=20-1178,6=20+1214,48=20@@=20= bytecomp-string-vs-docstring=0A=20=20=20(let=20((lexical-binding=20t))=0A= =20=20=20=20=20(should=20(equal=20(funcall=20(byte-compile=20'(lambda=20= (x)=20"foo"))=20'dummy)=20"foo"))))=0A=20=0A+(ert-deftest=20= bytecomp-condition-case-success=20()=0A+=20=20;;=20No=20error,=20no=20= success=20handler.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=2042)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20= 'bad=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '(42)))=0A+=20=20;;=20Error,=20no=20success=20handler.=0A+=20=20(should=20= (equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20'(bad=20arith-error)))=0A+=20=20;;=20No=20= error,=20success=20handler.=0A+=20=20(should=20(equal=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(:success=20(cons=20'good=20x)))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20'(good=2042)))=0A+=20=20;;=20Error,=20success=20= handler.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20'bad=20x))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:success=20= (cons=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '(bad=20arith-error)))=0A+=20=20;;=20Verify=20that=20the=20success=20= code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20=20= (should-error=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(:success=20(/=20(car=20x)=200)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20:type=20'arith-error)=0A+=20=20= ;;=20Check=20variable=20scoping.=0A+=20=20(let=20((x=202))=0A+=20=20=20=20= (should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:success=20= (list=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20'(good=20(2))))=0A+=20=20=20=20(should=20(equal=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(:success=20(list=20'good=20x)))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20'(bad=20(arith-error))))))=0A+=0A= =20;;=20Local=20Variables:=0A=20;;=20no-byte-compile:=20t=0A=20;;=20End:=0A= diff=20--git=20a/test/lisp/emacs-lisp/cl-macs-tests.el=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0Aindex=205c3e603b92..f4e2e46a01=20= 100644=0A---=20a/test/lisp/emacs-lisp/cl-macs-tests.el=0A+++=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0A@@=20-630,12=20+630,13=20@@=20= cl-macs--labels=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(and=20xs=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (progn=20(setq=20n1=20(1+=20n))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(len2=20(cdr=20xs)=20n1))))))=0A-=20=20=20=20=20=20=20=20=20;;=20= Tail=20call=20in=20error=20handler.=0A+=20=20=20=20=20=20=20=20=20;;=20= Tail=20calls=20in=20error=20and=20success=20handlers.=0A=20=20=20=20=20=20= =20=20=20=20(len3=20(xs=20n)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(if=20xs=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(/=201=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20(1+=20n))))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20k=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(/=201=20(logand=20n=201))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20= (1+=20n)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(:success=20(len3=20(cdr=20xs)=20(+=20n=20k))))=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20n)))=0A=20=20=20=20=20=20=20(should=20= (equal=20(len=20nil=200)=200))=0A=20=20=20=20=20=20=20(should=20(equal=20= (len2=20nil=200)=200))=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_2A1C3F29-9A56-4B7B-9D7A-3BD0DCF89340-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 10 19:52:29 2021 Received: (at 47677) by debbugs.gnu.org; 10 Apr 2021 23:52:30 +0000 Received: from localhost ([127.0.0.1]:53577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVNOv-000762-NU for submit@debbugs.gnu.org; Sat, 10 Apr 2021 19:52:29 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVNOt-00075q-TX for 47677@debbugs.gnu.org; Sat, 10 Apr 2021 19:52:28 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3EB41440C78; Sat, 10 Apr 2021 19:52:22 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 93F3C440FA8; Sat, 10 Apr 2021 19:52:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1618098740; bh=eGV4QJ3O0PfjnXHtpHHzbmI0MJMdsnUDJ34lna0g60Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=In1/9N5+GZr0KD9QiIjwvGbiV+UOIXl5LcbdXb3Pf6vYw3WVjks0bZjA57rpYAWRU cmz4rud/6Bw64ugpZbwY2U7t7CH6yTsouKORG9vr2i5WVNs4KICCMJ12tAuzF2sEZI QuzmxVnPAfw+3WryqnXn6YV7v0K9x/Kt4ll8NZNw2Vrcw1YekokFQm0ZVDGIqtkNia COyA3J4xHtATRE5wxTFot0wUElgDGGU3vPAO+SR7i0n1xiTcc5Btf1Q4j+B3hDxNzi i1gWl0T0IW55fh/Z9bB4s1SpGXBlu41CmogqdQkHQ7yjAiLFRohxSZJl7mb3Kbbiie GVFOOFBwwvNVQ== Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2F9021202F2; Sat, 10 Apr 2021 19:52:20 -0400 (EDT) From: Stefan Monnier To: Mattias =?windows-1252?Q?Engdeg=E5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation Message-ID: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> Date: Sat, 10 Apr 2021 19:52:19 -0400 In-Reply-To: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> ("Mattias =?windows-1252?Q?Engdeg=E5rd=22's?= message of "Fri, 9 Apr 2021 22:26:49 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.078 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > This patch adds the condition-case handler syntax > > (:success BODY) In the tests, you might want to add one with a lambda expression which captures a mutated success variable, as in (apply (condition-case res 42 (:success (prog1 (list (lambda (x) (+ res x)) res) (setq res 0))))) since this requires special handling in cconv.el. Other than that, the patch looks good to me. > Details of the syntax can be changed if there is a very good reason > for it. Many other languages have more or less independently added > equivalent constructs. Common Lisp's `handler-case` has a very similar > feature (:no-error). Any particular reason you chose ;success instead of :no-error? > It would be nice to give `catch` the same treatment. A particularly > flexible solution would be to add `catch` handlers to > `condition-case`, which would then be able to handle > everything. Unless there is a strong reason for doing it right away, > it can be seen as a later improvement. Let's take it one step at a time. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 11 07:13:50 2021 Received: (at 47677) by debbugs.gnu.org; 11 Apr 2021 11:13:50 +0000 Received: from localhost ([127.0.0.1]:54098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVY2I-0007Xv-F5 for submit@debbugs.gnu.org; Sun, 11 Apr 2021 07:13:50 -0400 Received: from mail1463c50.megamailservers.eu ([91.136.14.63]:42228 helo=mail268c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVY2F-0007Xh-TE for 47677@debbugs.gnu.org; Sun, 11 Apr 2021 07:13:48 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1618139621; bh=9vDRf11UrdDTjcgnfQUh+kFaFFro9aXC/ND43V14glw=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=Pq+pjiGOiLr/xn0W+navPUWvyiyMR280IaucVDTntpdFOcm6tPAEaqoKu2wRnjhoI X8Yq8hYkIDOzGsyd0e/nag+/BOLV1OaJG6t6LVScUx7R9CwNK9WZ1A67ot+/x8H7W3 T8V7bfzPKefbLnpChZ7Pzz1W90GfCdHQSMP27O/U= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail268c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13BBDch1008561; Sun, 11 Apr 2021 11:13:40 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_C263DC4E-AF63-46B3-9CCF-12B41A40D86F" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation Date: Sun, 11 Apr 2021 13:13:37 +0200 In-Reply-To: To: Stefan Monnier References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1E.6072D9E5.000D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Pq7tkDE3 c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=M51BFTxLslgA:10 a=iRZporoAAAAA:8 a=oSoEVI6B0U0HSzi3YrgA:9 a=CjuIK1q_8ugA:10 a=mGGVe17ArwRYEn8pBrIA:9 a=B2y7HmGcmWMA:10 a=NOBgFS-JBQ2l-kSd6-zu:22 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 11 apr. 2021 kl. 01.52 skrev Stefan Monnier : > In the tests, you might want to add one with a lambda expression which > captures a mutated success variable, as in > > (apply (condition-case res > 42 > (:success (prog1 (list (lambda (x) (+ res x) [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 47677 Cc: 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_C263DC4E-AF63-46B3-9CCF-12B41A40D86F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 11 apr. 2021 kl. 01.52 skrev Stefan Monnier : > In the tests, you might want to add one with a lambda expression which > captures a mutated success variable, as in >=20 > (apply (condition-case res > 42 > (:success (prog1 (list (lambda (x) (+ res x)) res) > (setq res 0))))) >=20 > since this requires special handling in cconv.el. Good catch! Fixed on master. (And I've added more test cases to the = patch.) > Any particular reason you chose ;success instead of :no-error? Only a few weak reasons -- some conditions (like quit) aren't errors, = although the documentation is very inconsistent on that point. And = :success felt slightly more descriptive, and it doesn't have a negation = in the name. Names like :default, :else, :otherwise etc were rejected because they = could be interpreted as 'any other error'. It may be a bit too far over the moon though. Would = :not-a-complete-failure be better? Fits my gloomy national temperaments = (all of them) better. Still undecided! --Apple-Mail=_C263DC4E-AF63-46B3-9CCF-12B41A40D86F Content-Disposition: attachment; filename=0001-Add-condition-case-success-handler-bug-47677.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-condition-case-success-handler-bug-47677.patch" Content-Transfer-Encoding: quoted-printable =46rom=20dcb8b351116e1785aa5395c3d3ffefd836cac4b4=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=207=20Apr=202021=2011:31:07=20+0200=0A= Subject:=20[PATCH]=20Add=20condition-case=20success=20handler=20= (bug#47677)=0A=0AAllow=20a=20condition-case=20handler=20on=20the=20form=20= (:success=20BODY)=20to=20be=0Aspecified=20as=20the=20success=20= continuation=20of=20the=20protected=20form,=20with=0Athe=20specified=20= variable=20bound=20to=20its=20result.=0A=0A*=20src/eval.c=20= (Fcondition_case):=20Update=20the=20doc=20string.=0A= (internal_lisp_condition_case):=20Implement=20in=20interpreter.=0A= (syms_of_eval):=20Defsym=20:success.=0A*=20lisp/emacs-lisp/bytecomp.el=20= (byte-compile-condition-case):=0AImplement=20in=20byte-compiler.=0A*=20= lisp/emacs-lisp/cl-macs.el=20(cl--self-tco):=20Allow=20self-TCO=0Afrom=20= success=20handler.=0A*=20doc/lispref/control.texi=20(Handling=20Errors):=20= Update=20manual.=0A*=20etc/NEWS:=20Announce.=0A*=20= test/lisp/emacs-lisp/bytecomp-tests.el=20(bytecomp-tests--test-cases)=0A= (bytecomp-condition-case-success):=0A*=20= test/lisp/emacs-lisp/cl-macs-tests.el=20(cl-macs--labels):=0AAdd=20test=20= cases.=0A---=0A=20doc/lispref/control.texi=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20|=20=209=20++-=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=205=20= ++=0A=20lisp/emacs-lisp/bytecomp.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= 28=20+++++++-=0A=20lisp/emacs-lisp/cl-macs.el=20=20=20=20=20=20=20=20=20=20= =20=20=20|=20=204=20+-=0A=20src/eval.c=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2034=20+++++++++-=0A= =20test/lisp/emacs-lisp/bytecomp-tests.el=20|=2093=20= ++++++++++++++++++++++++++=0A=20test/lisp/emacs-lisp/cl-macs-tests.el=20=20= |=20=209=20+--=0A=207=20files=20changed,=20172=20insertions(+),=2010=20= deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/control.texi=20= b/doc/lispref/control.texi=0Aindex=203388102f69..22b665bc93=20100644=0A= ---=20a/doc/lispref/control.texi=0A+++=20b/doc/lispref/control.texi=0A@@=20= -2012,7=20+2012,8=20@@=20Handling=20Errors=0A=20This=20special=20form=20= establishes=20the=20error=20handlers=20@var{handlers}=20around=0A=20the=20= execution=20of=20@var{protected-form}.=20=20If=20@var{protected-form}=20= executes=0A=20without=20error,=20the=20value=20it=20returns=20becomes=20= the=20value=20of=20the=0A-@code{condition-case}=20form;=20in=20this=20= case,=20the=20@code{condition-case}=20has=0A+@code{condition-case}=20= form=20(in=20the=20absence=20of=20a=20success=20handler;=20see=20below).=0A= +In=20this=20case,=20the=20@code{condition-case}=20has=0A=20no=20effect.=20= =20The=20@code{condition-case}=20form=20makes=20a=20difference=20when=20= an=0A=20error=20occurs=20during=20@var{protected-form}.=0A=20=0A@@=20= -2062,6=20+2063,12=20@@=20Handling=20Errors=0A=20If=20@var{var}=20is=20= @code{nil},=20that=20means=20no=20variable=20is=20bound.=20=20Then=20the=0A= =20error=20symbol=20and=20associated=20data=20are=20not=20available=20to=20= the=20handler.=0A=20=0A+@cindex=20success=20handler=0A+As=20a=20special=20= case,=20one=20of=20the=20@var{handlers}=20can=20be=20a=20list=20of=20the=0A= +form=20@code{(:success=20@var{body}@dots{})},=20where=20@var{body}=20is=20= executed=0A+with=20@var{var}=20(if=20non-@code{nil})=20bound=20to=20the=20= return=20value=20of=0A+@var{protected-form}=20when=20that=20expression=20= terminates=20without=20error.=0A+=0A=20@cindex=20rethrow=20a=20signal=0A=20= Sometimes=20it=20is=20necessary=20to=20re-throw=20a=20signal=20caught=20= by=0A=20@code{condition-case},=20for=20some=20outer-level=20handler=20to=20= catch.=20=20Here's=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= aaf38022c5..74d8ad0da7=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-2922,6=20+2922,11=20@@=20arrays=20nor=20objects.=0A=20The=20= special=20events=20'dbus-event'=20and=20'file-notify'=20are=20now=20= ignored=20in=0A=20'while-no-input'=20when=20added=20to=20this=20= variable.=0A=20=0A++++=0A+**=20'condition-case'=20now=20allows=20for=20a=20= success=20handler.=0A+It=20is=20executed=20whenever=20the=20protected=20= form=20terminates=20without=20error,=0A+with=20the=20specified=20= variable=20bound=20to=20the=20returned=20value.=0A+=0A=20=0C=0A=20*=20= Changes=20in=20Emacs=2028.1=20on=20Non-Free=20Operating=20Systems=0A=20=0A= diff=20--git=20a/lisp/emacs-lisp/bytecomp.el=20= b/lisp/emacs-lisp/bytecomp.el=0Aindex=200babbbb978..ce3a759487=20100644=0A= ---=20a/lisp/emacs-lisp/bytecomp.el=0A+++=20= b/lisp/emacs-lisp/bytecomp.el=0A@@=20-4621,10=20+4621,15=20@@=20= byte-compile-unwind-protect=0A=20(defun=20byte-compile-condition-case=20= (form)=0A=20=20=20(let*=20((var=20(nth=201=20form))=0A=20=20=20=20=20=20=20= =20=20=20(body=20(nth=202=20form))=0A+=20=20=20=20=20=20=20=20=20= (handlers=20(nthcdr=203=20form))=0A=20=20=20=20=20=20=20=20=20=20(depth=20= byte-compile-depth)=0A+=20=20=20=20=20=20=20=20=20(success-handler=20= (assq=20:success=20handlers))=0A+=20=20=20=20=20=20=20=20=20= (failure-handlers=20(if=20success-handler=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(remq=20= success-handler=20handlers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20handlers))=0A=20=20=20=20=20= =20=20=20=20=20(clauses=20(mapcar=20(lambda=20(clause)=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (cons=20(byte-compile-make-tag)=20clause))=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(nthcdr=203=20form)))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20failure-handlers))=0A=20=20=20=20=20=20=20=20=20=20(endtag=20= (byte-compile-make-tag)))=0A=20=20=20=20=20= (byte-compile-set-symbol-position=20'condition-case)=0A=20=20=20=20=20= (unless=20(symbolp=20var)=0A@@=20-4650,6=20+4655,27=20@@=20= byte-compile-condition-case=0A=20=0A=20=20=20=20=20(byte-compile-form=20= body)=20;;=20byte-compile--for-effect=0A=20=20=20=20=20(dolist=20(_=20= clauses)=20(byte-compile-out=20'byte-pophandler))=0A+=0A+=20=20=20=20= (when=20success-handler=0A+=20=20=20=20=20=20(let=20((success-body=20= (cdr=20success-handler)))=0A+=20=20=20=20=20=20=20=20(cond=0A+=20=20=20=20= =20=20=20=20=20((null=20var)=0A+=20=20=20=20=20=20=20=20=20=20= (byte-compile-discard)=0A+=20=20=20=20=20=20=20=20=20=20= (byte-compile-body=20success-body=20byte-compile--for-effect))=0A+=20=20=20= =20=20=20=20=20=20(lexical-binding=0A+=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile--lexical-environment=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20byte-compile--lexical-environment))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20(push=20(cons=20var=20(1-=20byte-compile-depth))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= byte-compile--lexical-environment)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-body=20success-body=20byte-compile--for-effect)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20(byte-compile-discard=201=20'preserve-tos)))=0A= +=20=20=20=20=20=20=20=20=20(t=0A+=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile-bound-variables=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20byte-compile-bound-variables))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20(byte-compile-dynamic-variable-bind=20var)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20(byte-compile-body=20success-body=20= byte-compile--for-effect)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-out=20'byte-unbind=201))))))=0A+=0A=20=20=20=20=20= (byte-compile-goto=20'byte-goto=20endtag)=0A=20=0A=20=20=20=20=20(while=20= clauses=0Adiff=20--git=20a/lisp/emacs-lisp/cl-macs.el=20= b/lisp/emacs-lisp/cl-macs.el=0Aindex=2068211ec410..b7e5be95bc=20100644=0A= ---=20a/lisp/emacs-lisp/cl-macs.el=0A+++=20b/lisp/emacs-lisp/cl-macs.el=0A= @@=20-2144,7=20+2144,9=20@@=20cl--self-tco=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20((and=20`(condition-case=20,err-var=20,bodyform=20.=20= ,handlers)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (guard=20(not=20(eq=20err-var=20var))))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20`(condition-case=20,err-var=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(progn=20(setq=20,retvar=20,bodyform)=20nil)=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20,(if=20(assq=20:success=20= handlers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20bodyform=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20`(progn=20(setq=20,retvar=20,bodyform)=20nil))=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20.=20,(mapcar=20(lambda=20(h)=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(cons=20(car=20h)=20(funcall=20opt-exps=20(cdr=20h))))=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= handlers)))=0Adiff=20--git=20a/src/eval.c=20b/src/eval.c=0Aindex=20= ddaa8edd81..41c4cd1637=20100644=0A---=20a/src/eval.c=0A+++=20= b/src/eval.c=0A@@=20-1301,7=20+1301,7=20@@=20DEFUN=20("condition-case",=20= Fcondition_case,=20Scondition_case,=202,=20UNEVALLED,=200,=0A=20=20=20=20= =20=20=20=20doc:=20/*=20Regain=20control=20when=20an=20error=20is=20= signaled.=0A=20Executes=20BODYFORM=20and=20returns=20its=20value=20if=20= no=20error=20happens.=0A=20Each=20element=20of=20HANDLERS=20looks=20like=20= (CONDITION-NAME=20BODY...)=0A-where=20the=20BODY=20is=20made=20of=20Lisp=20= expressions.=0A+or=20(:success=20BODY),=20where=20the=20BODY=20is=20made=20= of=20Lisp=20expressions.=0A=20=0A=20A=20handler=20is=20applicable=20to=20= an=20error=20if=20CONDITION-NAME=20is=20one=20of=20the=0A=20error's=20= condition=20names.=20=20Handlers=20may=20also=20apply=20when=20non-error=0A= @@=20-1323,6=20+1323,10=20@@=20DEFUN=20("condition-case",=20= Fcondition_case,=20Scondition_case,=202,=20UNEVALLED,=200,=0A=20Then=20= the=20value=20of=20the=20last=20BODY=20form=20is=20returned=20from=20the=20= `condition-case'=0A=20expression.=0A=20=0A+The=20special=20handler=20= (:success=20BODY)=20is=20invoked=20if=20BODYFORM=20terminated=0A+without=20= signalling=20an=20error.=20=20BODY=20is=20then=20evaluated=20with=20VAR=20= bound=20to=0A+the=20value=20returned=20by=20BODYFORM.=0A+=0A=20See=20= also=20the=20function=20`signal'=20for=20more=20info.=0A=20usage:=20= (condition-case=20VAR=20BODYFORM=20&rest=20HANDLERS)=20=20*/)=0A=20=20=20= (Lisp_Object=20args)=0A@@=20-1346,16=20+1350,21=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=0A=20=20=20CHECK_SYMBOL=20(var);=0A=20=0A+=20=20= Lisp_Object=20success_handler=20=3D=20Qnil;=0A+=0A=20=20=20for=20= (Lisp_Object=20tail=20=3D=20handlers;=20CONSP=20(tail);=20tail=20=3D=20= XCDR=20(tail))=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20Lisp_Object=20= tem=20=3D=20XCAR=20(tail);=0A-=20=20=20=20=20=20clausenb++;=0A=20=20=20=20= =20=20=20if=20(!=20(NILP=20(tem)=0A=20=09=20=20=20=20=20||=20(CONSP=20= (tem)=0A=20=09=09=20&&=20(SYMBOLP=20(XCAR=20(tem))=0A=20=09=09=20=20=20=20= =20||=20CONSP=20(XCAR=20(tem))))))=0A=20=09error=20("Invalid=20condition=20= handler:=20%s",=0A=20=09=20=20=20=20=20=20=20SDATA=20(Fprin1_to_string=20= (tem,=20Qt)));=0A+=20=20=20=20=20=20if=20(EQ=20(XCAR=20(tem),=20= QCsuccess))=0A+=09success_handler=20=3D=20XCDR=20(tem);=0A+=20=20=20=20=20= =20else=0A+=09clausenb++;=0A=20=20=20=20=20}=0A=20=0A=20=20=20/*=20The=20= first=20clause=20is=20the=20one=20that=20should=20be=20checked=20first,=20= so=20it=0A@@=20-1369,7=20+1378,8=20@@=20internal_lisp_condition_case=20= (Lisp_Object=20var,=20Lisp_Object=20bodyform,=0A=20=20=20Lisp_Object=20= volatile=20*clauses=20=3D=20alloca=20(clausenb=20*=20sizeof=20*clauses);=0A= =20=20=20clauses=20+=3D=20clausenb;=0A=20=20=20for=20(Lisp_Object=20tail=20= =3D=20handlers;=20CONSP=20(tail);=20tail=20=3D=20XCDR=20(tail))=0A-=20=20= =20=20*--clauses=20=3D=20XCAR=20(tail);=0A+=20=20=20=20if=20(!EQ=20(XCAR=20= (XCAR=20(tail)),=20QCsuccess))=0A+=20=20=20=20=20=20*--clauses=20=3D=20= XCAR=20(tail);=0A=20=20=20for=20(ptrdiff_t=20i=20=3D=200;=20i=20<=20= clausenb;=20i++)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20Lisp_Object=20= clause=20=3D=20clauses[i];=0A@@=20-1409,6=20+1419,23=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=0A=20=20=20Lisp_Object=20result=20=3D=20eval_sub=20= (bodyform);=0A=20=20=20handlerlist=20=3D=20oldhandlerlist;=0A+=20=20if=20= (!NILP=20(success_handler))=0A+=20=20=20=20{=0A+=20=20=20=20=20=20if=20= (NILP=20(var))=0A+=09return=20Fprogn=20(success_handler);=0A+=0A+=20=20=20= =20=20=20Lisp_Object=20handler_var=20=3D=20var;=0A+=20=20=20=20=20=20if=20= (!NILP=20(Vinternal_interpreter_environment))=0A+=09{=0A+=09=20=20result=20= =3D=20Fcons=20(Fcons=20(var,=20result),=0A+=09=09=20=20=20=20=20=20=20= Vinternal_interpreter_environment);=0A+=09=20=20handler_var=20=3D=20= Qinternal_interpreter_environment;=0A+=09}=0A+=0A+=20=20=20=20=20=20= ptrdiff_t=20count=20=3D=20SPECPDL_INDEX=20();=0A+=20=20=20=20=20=20= specbind=20(handler_var,=20result);=0A+=20=20=20=20=20=20return=20= unbind_to=20(count,=20Fprogn=20(success_handler));=0A+=20=20=20=20}=0A=20= =20=20return=20result;=0A=20}=0A=20=0A@@=20-4381,6=20+4408,7=20@@=20= syms_of_eval=20(void)=0A=20=20=20defsubr=20(&Sthrow);=0A=20=20=20defsubr=20= (&Sunwind_protect);=0A=20=20=20defsubr=20(&Scondition_case);=0A+=20=20= DEFSYM=20(QCsuccess,=20":success");=0A=20=20=20defsubr=20(&Ssignal);=0A=20= =20=20defsubr=20(&Scommandp);=0A=20=20=20defsubr=20(&Sautoload);=0Adiff=20= --git=20a/test/lisp/emacs-lisp/bytecomp-tests.el=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0Aindex=20= a11832d805..69543320a7=20100644=0A---=20= a/test/lisp/emacs-lisp/bytecomp-tests.el=0A+++=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0A@@=20-444,6=20+444,49=20@@=20= bytecomp-tests--test-cases=0A=20=20=20=20=20=20=20=20(arith-error=20= (prog1=20(lambda=20(y)=20(+=20y=20x))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(setq=20x=2010))))=0A=20=20=20=20=20=20= 4)=0A+=0A+=20=20=20=20;;=20No=20error,=20no=20success=20handler.=0A+=20=20= =20=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20= =20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20;;=20Error,=20no=20= success=20handler.=0A+=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20= =20=20(/=201=200)=0A+=20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20= =20=20=20;;=20No=20error,=20success=20handler.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(cons=20= 'good=20x)))=0A+=20=20=20=20;;=20Error,=20success=20handler.=0A+=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20= =20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20= (cons=20'good=20x)))=0A+=20=20=20=20;;=20Verify=20that=20the=20success=20= code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(/=20= (car=20x)=200)))=0A+=20=20=20=20;;=20Check=20variable=20scoping=20on=20= success.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20= =20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20=20= (:success=20(list=20'good=20x))))=0A+=20=20=20=20;;=20Check=20variable=20= scoping=20on=20failure.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20= =20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20= =20(:success=20(list=20'good=20x))))=0A+=20=20=20=20;;=20Check=20capture=20= of=20mutated=20result=20variable.=0A+=20=20=20=20(funcall=0A+=20=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=203=0A+=20=20=20=20=20= =20=20(:success=20(prog1=20(lambda=20(y)=20(+=20y=20x))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20x=2010))))=0A+=20=20=20= =20=204)=0A=20=20=20=20=20)=0A=20=20=20"List=20of=20expressions=20for=20= cross-testing=20interpreted=20and=20compiled=20code.")=0A=20=0A@@=20= -1185,6=20+1228,56=20@@=20bytecomp-string-vs-docstring=0A=20=20=20(let=20= ((lexical-binding=20t))=0A=20=20=20=20=20(should=20(equal=20(funcall=20= (byte-compile=20'(lambda=20(x)=20"foo"))=20'dummy)=20"foo"))))=0A=20=0A= +(ert-deftest=20bytecomp-condition-case-success=20()=0A+=20=20;;=20No=20= error,=20no=20success=20handler.=0A+=20=20(should=20(equal=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20'(42)))=0A+=20=20;;=20Error,=20no=20success=20handler.=0A= +=20=20(should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'(bad=20arith-error)))=0A+=20= =20;;=20No=20error,=20success=20handler.=0A+=20=20(should=20(equal=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(:success=20(cons=20'good=20x)))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20'(good=2042)))=0A+=20=20;;=20Error,=20= success=20handler.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20= 'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:success=20(cons=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20'(bad=20arith-error)))=0A+=20=20;;=20Verify=20that=20the=20= success=20code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20= =20(should-error=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(:success=20(/=20(car=20x)=200)))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20:type=20'arith-error)=0A+=20= =20;;=20Check=20variable=20scoping.=0A+=20=20(let=20((x=202))=0A+=20=20=20= =20(should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:success=20(list=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20'(good=20(2))))=0A+=20=20=20=20(should=20(equal=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(:success=20(list=20'good=20= x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'(bad=20= (arith-error)))))=0A+=20=20;;=20Check=20capture=20of=20mutated=20result=20= variable.=0A+=20=20(should=20(equal=20(funcall=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=203=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(:success=20(prog1=20(lambda=20(y)=20= (+=20y=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20x=2010))))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=204)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=2014)))=0A+=0A=20;;=20Local=20Variables:=0A=20;;=20= no-byte-compile:=20t=0A=20;;=20End:=0Adiff=20--git=20= a/test/lisp/emacs-lisp/cl-macs-tests.el=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0Aindex=205c3e603b92..f4e2e46a01=20= 100644=0A---=20a/test/lisp/emacs-lisp/cl-macs-tests.el=0A+++=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0A@@=20-630,12=20+630,13=20@@=20= cl-macs--labels=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(and=20xs=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (progn=20(setq=20n1=20(1+=20n))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(len2=20(cdr=20xs)=20n1))))))=0A-=20=20=20=20=20=20=20=20=20;;=20= Tail=20call=20in=20error=20handler.=0A+=20=20=20=20=20=20=20=20=20;;=20= Tail=20calls=20in=20error=20and=20success=20handlers.=0A=20=20=20=20=20=20= =20=20=20=20(len3=20(xs=20n)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(if=20xs=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(/=201=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20(1+=20n))))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20k=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(/=201=20(logand=20n=201))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20= (1+=20n)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(:success=20(len3=20(cdr=20xs)=20(+=20n=20k))))=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20n)))=0A=20=20=20=20=20=20=20(should=20= (equal=20(len=20nil=200)=200))=0A=20=20=20=20=20=20=20(should=20(equal=20= (len2=20nil=200)=200))=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_C263DC4E-AF63-46B3-9CCF-12B41A40D86F-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 12 04:49:23 2021 Received: (at 47677) by debbugs.gnu.org; 12 Apr 2021 08:49:23 +0000 Received: from localhost ([127.0.0.1]:56405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVsG2-0006CG-Nz for submit@debbugs.gnu.org; Mon, 12 Apr 2021 04:49:22 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVsG1-0006C4-4T for 47677@debbugs.gnu.org; Mon, 12 Apr 2021 04:49:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eYUORE4ttrPG0+jgIQZDQeStwWnS7wQzujeA7Uy6fvo=; b=FaMwlV1Vz6DDHW+MjOh2hJM8UV T/SpjD2TTBd0uE8Fp4bSGHcvSJfEQfACT407unCYXbSEPqdTgZyh7EQG1JlX4UYt32vyx97dnJ6xB ytcznnYRdeKb+j+aDVtQdrjQju9f4DDKnSYqgAbDYtTtUv9mYE6XE/poH1mkCYgRYHEw=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lVsFr-0005NO-NC; Mon, 12 Apr 2021 10:49:14 +0200 From: Lars Ingebrigtsen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> X-Now-Playing: Bertine Zetlitz's _Morbid Latenight Show_: "Abigail" Date: Mon, 12 Apr 2021 10:49:11 +0200 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sun, 11 Apr 2021 13:13:37 +0200") Message-ID: <87lf9nzy48.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Mattias EngdegÄrd writes: > It may be a bit too far over the moon though. Would > :not-a-complete-failure be better? Fits my gloomy national > temperaments (all of them) better. :-) Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd writes: > It may be a bit too far over the moon though. Would > :not-a-complete-failure be better? Fits my gloomy national > temperaments (all of them) better. :-) I like :success here. Let's bring some positivity. And I also like the feature -- you sometimes see people doing (condition-case (progn (something-that-may-fail) (setq didnt-fail t)) (error ...)) (when didnt-fail ...) and this would be much nicer. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 12 11:10:57 2021 Received: (at 47677) by debbugs.gnu.org; 12 Apr 2021 15:10:57 +0000 Received: from localhost ([127.0.0.1]:57729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVyDI-0001mH-T0 for submit@debbugs.gnu.org; Mon, 12 Apr 2021 11:10:57 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVyDH-0001m2-5t for 47677@debbugs.gnu.org; Mon, 12 Apr 2021 11:10:55 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8725710021D; Mon, 12 Apr 2021 11:10:49 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5B673100040; Mon, 12 Apr 2021 11:10:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1618240247; bh=RlrkGOcziaPgU+fnE75YTgTEYCoIBBLIW16ULJRpjdE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cR7Ii94+O9/aCFL+9GyWdocSkYPNOdm8j17vl74o/24YBgAmBvtiVmqBosE34cm/y WjDTPOriXFC2CWXyLdYoLJtQEd6CNbN+nQ6MTkpcMf0Vk3cQ6UYHstJfCfsmP1lVh1 fZUNAoRrq/UZzYxHleqgRvsT0BqvqqFp+9L1rp+3FcUlj23s6ZuvJ2Yvzp8aO8rOmd XLz/ujGwPm3LvSEXP0FIgVCVRFmjE4l118R69Mugdy0khk7vxMspfus3DBabJpM1NP tKIfhKAYNIC29QoKGf75Cf8crL9rkitzNVBRoqN/hnenBKchYn0sw5LsCB3SVmRS1S NQYcua/yHPMrA== Received: from alfajor (104-222-126-84.cpe.teksavvy.com [104.222.126.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2B6AA12076A; Mon, 12 Apr 2021 11:10:47 -0400 (EDT) From: Stefan Monnier To: Lars Ingebrigtsen Subject: Re: bug#47677: [PATCH] condition-case success continuation Message-ID: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> Date: Mon, 12 Apr 2021 11:10:40 -0400 In-Reply-To: <87lf9nzy48.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 12 Apr 2021 10:49:11 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: Mattias =?windows-1252?Q?Engdeg=E5rd?= , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> It may be a bit too far over the moon though. Would >> :not-a-complete-failure be better? Fits my gloomy national >> temperaments (all of them) better. > > :-) > > I like :success here. Let's bring some positivity. And I also like > the feature -- you sometimes see people doing > > (condition-case > (progn > (something-that-may-fail) > (setq didnt-fail t)) > (error ...)) > (when didnt-fail > ...) > > and this would be much nicer. Indeed, a nice sidekick to Mattias's patch would be another patch which rewrites some of those condition-cases. I know I wrote some of those but somehow can't remember where, nor can I think of a good way to grep for them. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 12 15:20:32 2021 Received: (at 47677) by debbugs.gnu.org; 12 Apr 2021 19:20:32 +0000 Received: from localhost ([127.0.0.1]:58110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW26q-0001em-Bz for submit@debbugs.gnu.org; Mon, 12 Apr 2021 15:20:32 -0400 Received: from mail150c50.megamailservers.eu ([91.136.10.160]:36648 helo=mail50c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lW26o-0001ed-C0 for 47677@debbugs.gnu.org; Mon, 12 Apr 2021 15:20:31 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1618255228; bh=wl7fPS2+678TsCooyO0AEHomNCL4nPoSK6YJDCyRZfs=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=XP5n9mkFTIXt4WBhXTCAjaL/rALFg0GmydBBAtYLdEvTlVEQJYuY8uaV2jOno2RZ5 LTNccv5TlXQV0OTNs3bqZvinit302Ha3jVRbngguDVcmy17i1CThDmMl2RwQ0fAZcS OJH0BO9iRqaZ33vGq73tXG2l7fc3DI3+5p4cjpYI= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail50c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13CJKPIi015306; Mon, 12 Apr 2021 19:20:27 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation Date: Mon, 12 Apr 2021 21:20:24 +0200 In-Reply-To: To: Stefan Monnier References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F24.60749D7C.002D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=JZTCUnCV c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=M51BFTxLslgA:10 a=Uv_scK_R3qRFpUfcwGQA:9 a=CjuIK1q_8ugA:10 a=yuwFoldsWfbauk4T1MIA:9 a=B2y7HmGcmWMA:10 a=6f-eSLppCT1XzX82WLoA:9 a=De_Ol2h6w80A:10 a=tclcd6dtLQvEqt9_mmAA:9 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 47677 Cc: Lars Ingebrigtsen , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Here is an updated patch that reduces some code duplication in the = compiler and fixes an embarrassing bug, and as a bonus, an experimental = add-on that allows catching throws in condition-case using the handler = syntax ((:catch TAG) BODY...) Unfortunately but unsurprisingly the decision to evaluate the TAG = expressions made everything much messier than anticipated. It does work, = though, and if you would like to redefine `catch` as the macro (defmacro catch (tag &rest body) (let ((var (gensym))) `(condition-case ,var (progn ,@body) ((:catch ,tag) ,var)))) then that will work, too (with minor byte-code inefficiency that could = easily be addressed). Any combination of error, :catch and :success handlers is permitted, = making this a very versatile construct. It may be a good idea to do away with the TAG evaluation since that = flexibility isn't likely to be in high demand. --Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B Content-Disposition: attachment; filename=0001-Add-condition-case-success-handler-bug-47677.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-condition-case-success-handler-bug-47677.patch" Content-Transfer-Encoding: quoted-printable =46rom=20864e56e63b45a05cb7ff274f33a2b4c9ee45746e=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=207=20Apr=202021=2011:31:07=20+0200=0A= Subject:=20[PATCH]=20Add=20condition-case=20success=20handler=20= (bug#47677)=0A=0AAllow=20a=20condition-case=20handler=20on=20the=20form=20= (:success=20BODY)=20to=20be=0Aspecified=20as=20the=20success=20= continuation=20of=20the=20protected=20form,=20with=0Athe=20specified=20= variable=20bound=20to=20its=20result.=0A=0A*=20src/eval.c=20= (Fcondition_case):=20Update=20the=20doc=20string.=0A= (internal_lisp_condition_case):=20Implement=20in=20interpreter.=0A= (syms_of_eval):=20Defsym=20:success.=0A*=20lisp/emacs-lisp/bytecomp.el=20= (byte-compile-condition-case):=0AImplement=20in=20byte-compiler.=0A*=20= lisp/emacs-lisp/cl-macs.el=20(cl--self-tco):=20Allow=20self-TCO=0Afrom=20= success=20handler.=0A*=20doc/lispref/control.texi=20(Handling=20Errors):=20= Update=20manual.=0A*=20etc/NEWS:=20Announce.=0A*=20= test/lisp/emacs-lisp/bytecomp-tests.el=20(bytecomp-tests--test-cases)=0A= (bytecomp-condition-case-success):=0A*=20= test/lisp/emacs-lisp/cl-macs-tests.el=20(cl-macs--labels):=0AAdd=20test=20= cases.=0A---=0A=20doc/lispref/control.texi=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20|=20=20=209=20+-=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20=205=20= +=0A=20lisp/emacs-lisp/bytecomp.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= =2063=20+++++++-----=0A=20lisp/emacs-lisp/cl-macs.el=20=20=20=20=20=20=20= =20=20=20=20=20=20|=20=20=204=20+-=0A=20src/eval.c=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=2034=20= ++++++-=0A=20test/lisp/emacs-lisp/bytecomp-tests.el=20|=20127=20= +++++++++++++++++++++++++=0A=20test/lisp/emacs-lisp/cl-macs-tests.el=20=20= |=20=20=209=20+-=0A=207=20files=20changed,=20218=20insertions(+),=2033=20= deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/control.texi=20= b/doc/lispref/control.texi=0Aindex=203388102f69..22b665bc93=20100644=0A= ---=20a/doc/lispref/control.texi=0A+++=20b/doc/lispref/control.texi=0A@@=20= -2012,7=20+2012,8=20@@=20Handling=20Errors=0A=20This=20special=20form=20= establishes=20the=20error=20handlers=20@var{handlers}=20around=0A=20the=20= execution=20of=20@var{protected-form}.=20=20If=20@var{protected-form}=20= executes=0A=20without=20error,=20the=20value=20it=20returns=20becomes=20= the=20value=20of=20the=0A-@code{condition-case}=20form;=20in=20this=20= case,=20the=20@code{condition-case}=20has=0A+@code{condition-case}=20= form=20(in=20the=20absence=20of=20a=20success=20handler;=20see=20below).=0A= +In=20this=20case,=20the=20@code{condition-case}=20has=0A=20no=20effect.=20= =20The=20@code{condition-case}=20form=20makes=20a=20difference=20when=20= an=0A=20error=20occurs=20during=20@var{protected-form}.=0A=20=0A@@=20= -2062,6=20+2063,12=20@@=20Handling=20Errors=0A=20If=20@var{var}=20is=20= @code{nil},=20that=20means=20no=20variable=20is=20bound.=20=20Then=20the=0A= =20error=20symbol=20and=20associated=20data=20are=20not=20available=20to=20= the=20handler.=0A=20=0A+@cindex=20success=20handler=0A+As=20a=20special=20= case,=20one=20of=20the=20@var{handlers}=20can=20be=20a=20list=20of=20the=0A= +form=20@code{(:success=20@var{body}@dots{})},=20where=20@var{body}=20is=20= executed=0A+with=20@var{var}=20(if=20non-@code{nil})=20bound=20to=20the=20= return=20value=20of=0A+@var{protected-form}=20when=20that=20expression=20= terminates=20without=20error.=0A+=0A=20@cindex=20rethrow=20a=20signal=0A=20= Sometimes=20it=20is=20necessary=20to=20re-throw=20a=20signal=20caught=20= by=0A=20@code{condition-case},=20for=20some=20outer-level=20handler=20to=20= catch.=20=20Here's=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= 7483a6e5b7..4ce33f06f0=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-2922,6=20+2922,11=20@@=20arrays=20nor=20objects.=0A=20The=20= special=20events=20'dbus-event'=20and=20'file-notify'=20are=20now=20= ignored=20in=0A=20'while-no-input'=20when=20added=20to=20this=20= variable.=0A=20=0A++++=0A+**=20'condition-case'=20now=20allows=20for=20a=20= success=20handler.=0A+It=20is=20executed=20whenever=20the=20protected=20= form=20terminates=20without=20error,=0A+with=20the=20specified=20= variable=20bound=20to=20the=20returned=20value.=0A+=0A=20=0C=0A=20*=20= Changes=20in=20Emacs=2028.1=20on=20Non-Free=20Operating=20Systems=0A=20=0A= diff=20--git=20a/lisp/emacs-lisp/bytecomp.el=20= b/lisp/emacs-lisp/bytecomp.el=0Aindex=200babbbb978..4f91f0d5de=20100644=0A= ---=20a/lisp/emacs-lisp/bytecomp.el=0A+++=20= b/lisp/emacs-lisp/bytecomp.el=0A@@=20-4621,10=20+4621,15=20@@=20= byte-compile-unwind-protect=0A=20(defun=20byte-compile-condition-case=20= (form)=0A=20=20=20(let*=20((var=20(nth=201=20form))=0A=20=20=20=20=20=20=20= =20=20=20(body=20(nth=202=20form))=0A+=20=20=20=20=20=20=20=20=20= (handlers=20(nthcdr=203=20form))=0A=20=20=20=20=20=20=20=20=20=20(depth=20= byte-compile-depth)=0A+=20=20=20=20=20=20=20=20=20(success-handler=20= (assq=20:success=20handlers))=0A+=20=20=20=20=20=20=20=20=20= (failure-handlers=20(if=20success-handler=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(remq=20= success-handler=20handlers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20handlers))=0A=20=20=20=20=20= =20=20=20=20=20(clauses=20(mapcar=20(lambda=20(clause)=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (cons=20(byte-compile-make-tag)=20clause))=0A-=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(nthcdr=203=20form)))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20failure-handlers))=0A=20=20=20=20=20=20=20=20=20=20(endtag=20= (byte-compile-make-tag)))=0A=20=20=20=20=20= (byte-compile-set-symbol-position=20'condition-case)=0A=20=20=20=20=20= (unless=20(symbolp=20var)=0A@@=20-4650,30=20+4655,40=20@@=20= byte-compile-condition-case=0A=20=0A=20=20=20=20=20(byte-compile-form=20= body)=20;;=20byte-compile--for-effect=0A=20=20=20=20=20(dolist=20(_=20= clauses)=20(byte-compile-out=20'byte-pophandler))=0A-=20=20=20=20= (byte-compile-goto=20'byte-goto=20endtag)=0A=20=0A-=20=20=20=20(while=20= clauses=0A-=20=20=20=20=20=20(let=20((clause=20(pop=20clauses))=0A-=20=20= =20=20=20=20=20=20=20=20=20=20(byte-compile-bound-variables=20= byte-compile-bound-variables)=0A-=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile--lexical-environment=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20byte-compile--lexical-environment))=0A-=20=20=20=20=20=20=20=20(setq=20= byte-compile-depth=20(1+=20depth))=0A-=20=20=20=20=20=20=20=20= (byte-compile-out-tag=20(pop=20clause))=0A-=20=20=20=20=20=20=20=20= (dolist=20(_=20clauses)=20(byte-compile-out=20'byte-pophandler))=0A-=20=20= =20=20=20=20=20=20(cond=0A-=20=20=20=20=20=20=20=20=20((null=20var)=20= (byte-compile-discard))=0A-=20=20=20=20=20=20=20=20=20(lexical-binding=0A= -=20=20=20=20=20=20=20=20=20=20(push=20(cons=20var=20(1-=20= byte-compile-depth))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= byte-compile--lexical-environment))=0A-=20=20=20=20=20=20=20=20=20(t=20= (byte-compile-dynamic-variable-bind=20var)))=0A-=20=20=20=20=20=20=20=20= (byte-compile-body=20(cdr=20clause))=20;;=20byte-compile--for-effect=0A-=20= =20=20=20=20=20=20=20(cond=0A-=20=20=20=20=20=20=20=20=20((null=20var)=20= nil)=0A-=20=20=20=20=20=20=20=20=20(lexical-binding=20= (byte-compile-discard=201=20'preserve-tos))=0A-=20=20=20=20=20=20=20=20=20= (t=20(byte-compile-out=20'byte-unbind=201)))=0A-=20=20=20=20=20=20=20=20= (byte-compile-goto=20'byte-goto=20endtag)))=0A-=0A-=20=20=20=20= (byte-compile-out-tag=20endtag)))=0A+=20=20=20=20(let=20= ((compile-handler-body=0A+=20=20=20=20=20=20=20=20=20=20=20(lambda=20= (body)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20= ((byte-compile-bound-variables=20byte-compile-bound-variables)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile--lexical-environment=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20byte-compile--lexical-environment))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(cond=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20((null=20var)=20(byte-compile-discard))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(lexical-binding=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(push=20(cons=20var=20(1-=20= byte-compile-depth))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20byte-compile--lexical-environment))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(t=20(byte-compile-dynamic-variable-bind=20= var)))=0A+=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-body=20body)=20;;=20byte-compile--for-effect=0A+=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(cond=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20((null=20var))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(lexical-binding=20(byte-compile-discard=201=20'preserve-tos))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20(byte-compile-out=20= 'byte-unbind=201)))))))=0A+=0A+=20=20=20=20=20=20(when=20success-handler=0A= +=20=20=20=20=20=20=20=20(funcall=20compile-handler-body=20(cdr=20= success-handler)))=0A+=0A+=20=20=20=20=20=20(byte-compile-goto=20= 'byte-goto=20endtag)=0A+=0A+=20=20=20=20=20=20(while=20clauses=0A+=20=20=20= =20=20=20=20=20(let=20((clause=20(pop=20clauses)))=0A+=20=20=20=20=20=20=20= =20=20=20(setq=20byte-compile-depth=20(1+=20depth))=0A+=20=20=20=20=20=20= =20=20=20=20(byte-compile-out-tag=20(pop=20clause))=0A+=20=20=20=20=20=20= =20=20=20=20(dolist=20(_=20clauses)=20(byte-compile-out=20= 'byte-pophandler))=0A+=20=20=20=20=20=20=20=20=20=20(funcall=20= compile-handler-body=20(cdr=20clause))=0A+=20=20=20=20=20=20=20=20=20=20= (byte-compile-goto=20'byte-goto=20endtag)))=0A+=0A+=20=20=20=20=20=20= (byte-compile-out-tag=20endtag))))=0A=20=0A=20(defun=20= byte-compile-save-excursion=20(form)=0A=20=20=20(if=20(and=20(eq=20= 'set-buffer=20(car-safe=20(car-safe=20(cdr=20form))))=0Adiff=20--git=20= a/lisp/emacs-lisp/cl-macs.el=20b/lisp/emacs-lisp/cl-macs.el=0Aindex=20= 68211ec410..b7e5be95bc=20100644=0A---=20a/lisp/emacs-lisp/cl-macs.el=0A= +++=20b/lisp/emacs-lisp/cl-macs.el=0A@@=20-2144,7=20+2144,9=20@@=20= cl--self-tco=0A=20=20=20=20=20=20=20=20=20=20=20=20=20((and=20= `(condition-case=20,err-var=20,bodyform=20.=20,handlers)=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(guard=20(not=20(eq=20err-var=20= var))))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20`(condition-case=20= ,err-var=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(progn=20= (setq=20,retvar=20,bodyform)=20nil)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20,(if=20(assq=20:success=20handlers)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20bodyform=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20`(progn=20(setq=20= ,retvar=20,bodyform)=20nil))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20.=20,(mapcar=20(lambda=20(h)=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cons=20(car=20= h)=20(funcall=20opt-exps=20(cdr=20h))))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20handlers)))=0Adiff=20= --git=20a/src/eval.c=20b/src/eval.c=0Aindex=20ddaa8edd81..fd93f5b9e1=20= 100644=0A---=20a/src/eval.c=0A+++=20b/src/eval.c=0A@@=20-1301,7=20= +1301,7=20@@=20DEFUN=20("condition-case",=20Fcondition_case,=20= Scondition_case,=202,=20UNEVALLED,=200,=0A=20=20=20=20=20=20=20=20doc:=20= /*=20Regain=20control=20when=20an=20error=20is=20signaled.=0A=20Executes=20= BODYFORM=20and=20returns=20its=20value=20if=20no=20error=20happens.=0A=20= Each=20element=20of=20HANDLERS=20looks=20like=20(CONDITION-NAME=20= BODY...)=0A-where=20the=20BODY=20is=20made=20of=20Lisp=20expressions.=0A= +or=20(:success=20BODY...),=20where=20the=20BODY=20is=20made=20of=20Lisp=20= expressions.=0A=20=0A=20A=20handler=20is=20applicable=20to=20an=20error=20= if=20CONDITION-NAME=20is=20one=20of=20the=0A=20error's=20condition=20= names.=20=20Handlers=20may=20also=20apply=20when=20non-error=0A@@=20= -1323,6=20+1323,10=20@@=20DEFUN=20("condition-case",=20Fcondition_case,=20= Scondition_case,=202,=20UNEVALLED,=200,=0A=20Then=20the=20value=20of=20= the=20last=20BODY=20form=20is=20returned=20from=20the=20`condition-case'=0A= =20expression.=0A=20=0A+The=20special=20handler=20(:success=20BODY...)=20= is=20invoked=20if=20BODYFORM=20terminated=0A+without=20signalling=20an=20= error.=20=20BODY=20is=20then=20evaluated=20with=20VAR=20bound=20to=0A= +the=20value=20returned=20by=20BODYFORM.=0A+=0A=20See=20also=20the=20= function=20`signal'=20for=20more=20info.=0A=20usage:=20(condition-case=20= VAR=20BODYFORM=20&rest=20HANDLERS)=20=20*/)=0A=20=20=20(Lisp_Object=20= args)=0A@@=20-1346,16=20+1350,21=20@@=20internal_lisp_condition_case=20= (Lisp_Object=20var,=20Lisp_Object=20bodyform,=0A=20=0A=20=20=20= CHECK_SYMBOL=20(var);=0A=20=0A+=20=20Lisp_Object=20success_handler=20=3D=20= Qnil;=0A+=0A=20=20=20for=20(Lisp_Object=20tail=20=3D=20handlers;=20CONSP=20= (tail);=20tail=20=3D=20XCDR=20(tail))=0A=20=20=20=20=20{=0A=20=20=20=20=20= =20=20Lisp_Object=20tem=20=3D=20XCAR=20(tail);=0A-=20=20=20=20=20=20= clausenb++;=0A=20=20=20=20=20=20=20if=20(!=20(NILP=20(tem)=0A=20=09=20=20= =20=20=20||=20(CONSP=20(tem)=0A=20=09=09=20&&=20(SYMBOLP=20(XCAR=20= (tem))=0A=20=09=09=20=20=20=20=20||=20CONSP=20(XCAR=20(tem))))))=0A=20=09= error=20("Invalid=20condition=20handler:=20%s",=0A=20=09=20=20=20=20=20=20= =20SDATA=20(Fprin1_to_string=20(tem,=20Qt)));=0A+=20=20=20=20=20=20if=20= (EQ=20(XCAR=20(tem),=20QCsuccess))=0A+=09success_handler=20=3D=20XCDR=20= (tem);=0A+=20=20=20=20=20=20else=0A+=09clausenb++;=0A=20=20=20=20=20}=0A=20= =0A=20=20=20/*=20The=20first=20clause=20is=20the=20one=20that=20should=20= be=20checked=20first,=20so=20it=0A@@=20-1369,7=20+1378,8=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=20=20Lisp_Object=20volatile=20*clauses=20=3D=20alloca=20= (clausenb=20*=20sizeof=20*clauses);=0A=20=20=20clauses=20+=3D=20= clausenb;=0A=20=20=20for=20(Lisp_Object=20tail=20=3D=20handlers;=20CONSP=20= (tail);=20tail=20=3D=20XCDR=20(tail))=0A-=20=20=20=20*--clauses=20=3D=20= XCAR=20(tail);=0A+=20=20=20=20if=20(!EQ=20(XCAR=20(XCAR=20(tail)),=20= QCsuccess))=0A+=20=20=20=20=20=20*--clauses=20=3D=20XCAR=20(tail);=0A=20=20= =20for=20(ptrdiff_t=20i=20=3D=200;=20i=20<=20clausenb;=20i++)=0A=20=20=20= =20=20{=0A=20=20=20=20=20=20=20Lisp_Object=20clause=20=3D=20clauses[i];=0A= @@=20-1409,6=20+1419,23=20@@=20internal_lisp_condition_case=20= (Lisp_Object=20var,=20Lisp_Object=20bodyform,=0A=20=0A=20=20=20= Lisp_Object=20result=20=3D=20eval_sub=20(bodyform);=0A=20=20=20= handlerlist=20=3D=20oldhandlerlist;=0A+=20=20if=20(!NILP=20= (success_handler))=0A+=20=20=20=20{=0A+=20=20=20=20=20=20if=20(NILP=20= (var))=0A+=09return=20Fprogn=20(success_handler);=0A+=0A+=20=20=20=20=20=20= Lisp_Object=20handler_var=20=3D=20var;=0A+=20=20=20=20=20=20if=20(!NILP=20= (Vinternal_interpreter_environment))=0A+=09{=0A+=09=20=20result=20=3D=20= Fcons=20(Fcons=20(var,=20result),=0A+=09=09=20=20=20=20=20=20=20= Vinternal_interpreter_environment);=0A+=09=20=20handler_var=20=3D=20= Qinternal_interpreter_environment;=0A+=09}=0A+=0A+=20=20=20=20=20=20= ptrdiff_t=20count=20=3D=20SPECPDL_INDEX=20();=0A+=20=20=20=20=20=20= specbind=20(handler_var,=20result);=0A+=20=20=20=20=20=20return=20= unbind_to=20(count,=20Fprogn=20(success_handler));=0A+=20=20=20=20}=0A=20= =20=20return=20result;=0A=20}=0A=20=0A@@=20-4381,6=20+4408,7=20@@=20= syms_of_eval=20(void)=0A=20=20=20defsubr=20(&Sthrow);=0A=20=20=20defsubr=20= (&Sunwind_protect);=0A=20=20=20defsubr=20(&Scondition_case);=0A+=20=20= DEFSYM=20(QCsuccess,=20":success");=0A=20=20=20defsubr=20(&Ssignal);=0A=20= =20=20defsubr=20(&Scommandp);=0A=20=20=20defsubr=20(&Sautoload);=0Adiff=20= --git=20a/test/lisp/emacs-lisp/bytecomp-tests.el=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0Aindex=20= a11832d805..c9ab3ec1f1=20100644=0A---=20= a/test/lisp/emacs-lisp/bytecomp-tests.el=0A+++=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0A@@=20-444,6=20+444,65=20@@=20= bytecomp-tests--test-cases=0A=20=20=20=20=20=20=20=20(arith-error=20= (prog1=20(lambda=20(y)=20(+=20y=20x))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(setq=20x=2010))))=0A=20=20=20=20=20=20= 4)=0A+=0A+=20=20=20=20;;=20No=20error,=20no=20success=20handler.=0A+=20=20= =20=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20= =20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20;;=20Error,=20no=20= success=20handler.=0A+=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20= =20=20(/=201=200)=0A+=20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20= =20=20=20;;=20No=20error,=20success=20handler.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(cons=20= 'good=20x)))=0A+=20=20=20=20;;=20Error,=20success=20handler.=0A+=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20= =20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20= (cons=20'good=20x)))=0A+=20=20=20=20;;=20Verify=20that=20the=20success=20= code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20= =20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20(:success=20(/=20= (car=20x)=200)))=0A+=20=20=20=20;;=20Check=20variable=20scoping=20on=20= success.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20=20= (condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20= =20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20=20= (:success=20(list=20'good=20x))))=0A+=20=20=20=20;;=20Check=20variable=20= scoping=20on=20failure.=0A+=20=20=20=20(let=20((x=202))=0A+=20=20=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20= =20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20= =20(:success=20(list=20'good=20x))))=0A+=20=20=20=20;;=20Check=20capture=20= of=20mutated=20result=20variable.=0A+=20=20=20=20(funcall=0A+=20=20=20=20= =20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=203=0A+=20=20=20=20=20= =20=20(:success=20(prog1=20(lambda=20(y)=20(+=20y=20x))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20x=2010))))=0A+=20=20=20= =20=204)=0A+=20=20=20=20;;=20Check=20for-effect=20context,=20on=20error.=0A= +=20=20=20=20(let=20((f=20(lambda=20(x)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(condition-case=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(error=20'bad)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(:success=20'good))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(1+=20x))))=0A+=20=20=20=20=20=20(funcall=20f=203))=0A+=20=20=20=20;;=20= Check=20for-effect=20context,=20on=20success.=0A+=20=20=20=20(let=20((f=20= (lambda=20(x)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20'bad)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:success=20'good))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(1+=20= x))))=0A+=20=20=20=20=20=20(funcall=20f=203))=0A=20=20=20=20=20)=0A=20=20= =20"List=20of=20expressions=20for=20cross-testing=20interpreted=20and=20= compiled=20code.")=0A=20=0A@@=20-1185,6=20+1244,74=20@@=20= bytecomp-string-vs-docstring=0A=20=20=20(let=20((lexical-binding=20t))=0A= =20=20=20=20=20(should=20(equal=20(funcall=20(byte-compile=20'(lambda=20= (x)=20"foo"))=20'dummy)=20"foo"))))=0A=20=0A+(ert-deftest=20= bytecomp-condition-case-success=20()=0A+=20=20;;=20No=20error,=20no=20= success=20handler.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=2042)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20= 'bad=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '(42)))=0A+=20=20;;=20Error,=20no=20success=20handler.=0A+=20=20(should=20= (equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(error=20(cons=20'bad=20x)))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20'(bad=20arith-error)))=0A+=20=20;;=20No=20= error,=20success=20handler.=0A+=20=20(should=20(equal=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(:success=20(cons=20'good=20x)))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20'(good=2042)))=0A+=20=20;;=20Error,=20success=20= handler.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(cons=20'bad=20x))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:success=20= (cons=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '(bad=20arith-error)))=0A+=20=20;;=20Verify=20that=20the=20success=20= code=20is=20not=20subject=20to=20the=20error=20handlers.=0A+=20=20= (should-error=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(list=2042)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(error=20(cons=20'bad=20x))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(:success=20(/=20(car=20x)=200)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20:type=20'arith-error)=0A+=20=20= ;;=20Check=20variable=20scoping.=0A+=20=20(let=20((x=202))=0A+=20=20=20=20= (should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(list=20x)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(list=20'bad=20x))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(:success=20= (list=20'good=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20'(good=20(2))))=0A+=20=20=20=20(should=20(equal=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (/=201=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(error=20(list=20'bad=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(:success=20(list=20'good=20x)))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20'(bad=20(arith-error)))))=0A+=20= =20;;=20Check=20capture=20of=20mutated=20result=20variable.=0A+=20=20= (should=20(equal=20(funcall=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=203=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(:success=20(prog1=20(lambda=20(y)=20(+=20y=20x))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(setq=20x=2010))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=204)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =2014))=0A+=20=20=20=20;;=20Check=20for-effect=20context,=20on=20error.=0A= +=20=20(should=20(equal=20(let=20((f=20(lambda=20(x)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(/=201=200)=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(error=20'bad)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(:success=20'good))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(1+=20= x))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (funcall=20f=203))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 4))=0A+=20=20;;=20Check=20for-effect=20context,=20on=20success.=0A+=20=20= (should=20(equal=20(let=20((f=20(lambda=20(x)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20nil=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20'bad)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(:success=20'good))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(1+=20= x))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (funcall=20f=203))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 4)))=0A+=0A=20;;=20Local=20Variables:=0A=20;;=20no-byte-compile:=20t=0A=20= ;;=20End:=0Adiff=20--git=20a/test/lisp/emacs-lisp/cl-macs-tests.el=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0Aindex=205c3e603b92..f4e2e46a01=20= 100644=0A---=20a/test/lisp/emacs-lisp/cl-macs-tests.el=0A+++=20= b/test/lisp/emacs-lisp/cl-macs-tests.el=0A@@=20-630,12=20+630,13=20@@=20= cl-macs--labels=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(and=20xs=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (progn=20(setq=20n1=20(1+=20n))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(len2=20(cdr=20xs)=20n1))))))=0A-=20=20=20=20=20=20=20=20=20;;=20= Tail=20call=20in=20error=20handler.=0A+=20=20=20=20=20=20=20=20=20;;=20= Tail=20calls=20in=20error=20and=20success=20handlers.=0A=20=20=20=20=20=20= =20=20=20=20(len3=20(xs=20n)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(if=20xs=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20nil=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(/=201=200)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20(1+=20n))))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (condition-case=20k=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(/=201=20(logand=20n=201))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(arith-error=20(len3=20(cdr=20xs)=20= (1+=20n)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(:success=20(len3=20(cdr=20xs)=20(+=20n=20k))))=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20n)))=0A=20=20=20=20=20=20=20(should=20= (equal=20(len=20nil=200)=200))=0A=20=20=20=20=20=20=20(should=20(equal=20= (len2=20nil=200)=200))=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B Content-Disposition: attachment; filename=catch-in-condition-case.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="catch-in-condition-case.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4f91f0d5de..82e0edd772 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4636,22 +4636,34 @@ byte-compile-condition-case (byte-compile-warn "`%s' is not a variable-name or nil (in condition-case)" var)) - (dolist (clause (reverse clauses)) - (let ((condition (nth 1 clause))) - (unless (consp condition) (setq condition (list condition))) - (dolist (c condition) - (unless (and c (symbolp c)) - (byte-compile-warn - "`%S' is not a condition name (in condition-case)" c)) - ;; In reality, the `error-conditions' property is only required - ;; for the argument to `signal', not to `condition-case'. - ;;(unless (consp (get c 'error-conditions)) - ;; (byte-compile-warn - ;; "`%s' is not a known condition name (in condition-case)" - ;; c)) - ) - (byte-compile-push-constant condition)) - (byte-compile-goto 'byte-pushconditioncase (car clause))) + (let ((initial-depth byte-compile-depth) + (push-ops nil)) + ;; Push all conditions and tags in left-to-right order first, + ;; since tags need to be evaluated outside the scope of the handlers. + (dolist (clause clauses) + (let ((condition (nth 1 clause))) + (pcase condition + (`(:catch ,tag-expr) + (byte-compile-form tag-expr) + (push (cons 'byte-pushcatch (car clause)) push-ops)) + (`(:catch . ,_) + (error "malformed :catch clause: `%S'" (cdr clause))) + (_ ; error clause + (unless (consp condition) + (setq condition (list condition))) + (dolist (c condition) + (unless (and c (symbolp c)) + (byte-compile-warn + "`%S' is not a condition name (in condition-case)" c))) + (byte-compile-push-constant condition) + (push (cons 'byte-pushconditioncase (car clause)) push-ops))))) + ;; Then emit the handler activations in reverse order so that the + ;; first handler becomes the innermost. + (dolist (op push-ops) + ;; Use the depth at which the jumps will take place in the tag. + (setq byte-compile-depth (1+ initial-depth)) + (byte-compile-goto (car op) (cdr op))) + (cl-assert (equal byte-compile-depth initial-depth))) (byte-compile-form body) ;; byte-compile--for-effect (dolist (_ clauses) (byte-compile-out 'byte-pophandler)) diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index b37cfebab3..1651e47cfe 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -510,14 +510,18 @@ cconv-convert newprotform) ,@(mapcar (lambda (handler) - `(,(car handler) - ,@(let ((body - (mapcar (lambda (form) - (cconv-convert form newenv extend)) - (cdr handler)))) - (if (not (eq class :captured+mutated)) - body - `((let ((,var (list ,var))) ,@body)))))) + (let ((head (pcase (car handler) + (`(:catch ,tag-exp) + `(:catch ,(cconv-convert tag-exp env extend))) + (h h)))) + `(,head + ,@(let ((body + (mapcar (lambda (form) + (cconv-convert form newenv extend)) + (cdr handler)))) + (if (not (eq class :captured+mutated)) + body + `((let ((,var (list ,var))) ,@body))))))) handlers)))) (`(unwind-protect ,form . ,body) @@ -736,6 +740,10 @@ cconv-analyze-form (`(function . ,_) nil) ; same as quote (`(condition-case ,var ,protected-form . ,handlers) + (dolist (handler handlers) + (pcase handler + (`((:catch ,tag-exp) . ,_) + (cconv-analyze-form tag-exp env)))) (cconv-analyze-form protected-form env) (when (and var (symbolp var) (byte-compile-not-lexical-var-p var)) (byte-compile-warn diff --git a/src/eval.c b/src/eval.c index fd93f5b9e1..8a7676ec7a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1351,6 +1351,7 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, CHECK_SYMBOL (var); Lisp_Object success_handler = Qnil; + Lisp_Object tags = Qnil; /* Evaluated catch tags in reverse order. */ for (Lisp_Object tail = handlers; CONSP (tail); tail = XCDR (tail)) { @@ -1361,10 +1362,21 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, || CONSP (XCAR (tem)))))) error ("Invalid condition handler: %s", SDATA (Fprin1_to_string (tem, Qt))); - if (EQ (XCAR (tem), QCsuccess)) + Lisp_Object head = XCAR (tem); + if (EQ (head, QCsuccess)) success_handler = XCDR (tem); else - clausenb++; + { + if (CONSP (head) && EQ (XCAR (head), QCcatch)) + { + if (NILP (XCDR (head)) || !NILP (XCDR (XCDR (head)))) + error ("Invalid condition handler: %s", + SDATA (Fprin1_to_string (tem, Qt))); + Lisp_Object tag = eval_sub (XCAR (XCDR (head))); + tags = Fcons (tag, tags); + } + clausenb++; + } } /* The first clause is the one that should be checked first, so it @@ -1386,7 +1398,15 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, Lisp_Object condition = CONSP (clause) ? XCAR (clause) : Qnil; if (!CONSP (condition)) condition = list1 (condition); - struct handler *c = push_handler (condition, CONDITION_CASE); + struct handler *c; + if (EQ (XCAR (condition), QCcatch)) + { + Lisp_Object tag = XCAR (tags); + tags = XCDR (tags); + c = push_handler (tag, CATCHER); + } + else + c = push_handler (condition, CONDITION_CASE); if (sys_setjmp (c->jmp)) { Lisp_Object val = handlerlist->val; @@ -4409,6 +4429,7 @@ syms_of_eval (void) defsubr (&Sunwind_protect); defsubr (&Scondition_case); DEFSYM (QCsuccess, ":success"); + DEFSYM (QCcatch, ":catch"); defsubr (&Ssignal); defsubr (&Scommandp); defsubr (&Sautoload); diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index c9ab3ec1f1..af02810f31 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -503,6 +503,38 @@ bytecomp-tests--test-cases (:success 'good)) (1+ x)))) (funcall f 3)) + + ;; Catching throws. + (let ((g (lambda (f) + (let ((tags (list 'a 'b))) + (condition-case x + (funcall f) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-a x)) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-b x)) + (:success (list 'ok x))))))) + (list (funcall g (lambda () 2)) + (funcall g (lambda () (throw 'a 3))) + (funcall g (lambda () (throw 'b 5))))) + + ;; Catching throws and errors. + (let ((g (lambda (f) + (let ((tags (list 'a 'b))) + (condition-case x + (funcall f) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-a x)) + (arith-error (list 'arith x)) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-b x)) + (error (list 'err x)) + (:success (list 'ok x))))))) + (list (funcall g (lambda () 2)) + (funcall g (lambda () (throw 'a 3))) + (funcall g (lambda () (throw 'b 5))) + (funcall g (lambda () (/ 1 0))) + (funcall g (lambda () (signal 'error nil))))) ) "List of expressions for cross-testing interpreted and compiled code.") @@ -1310,7 +1342,45 @@ bytecomp-condition-case-success (:success 'good)) (1+ x)))) (funcall f 3)) - 4))) + 4)) + + ;; Catching throws. + (should (equal + (let ((g (lambda (f) + (let ((tags (list 'a 'b))) + (condition-case x + (funcall f) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-a x)) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-b x)) + (:success (list 'ok x))))))) + (list (funcall g (lambda () 2)) + (funcall g (lambda () (throw 'a 3))) + (funcall g (lambda () (throw 'b 5))))) + '((ok 2) (catch-a 3) (catch-b 5)))) + + ;; Catching throws and errors. + (should (equal + (let ((g (lambda (f) + (let ((tags (list 'a 'b))) + (condition-case x + (funcall f) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-a x)) + (arith-error (list 'arith x)) + ((:catch (prog1 (car tags) (setq tags (cdr tags)))) + (list 'catch-b x)) + (error (list 'err x)) + (:success (list 'ok x))))))) + (list (funcall g (lambda () 2)) + (funcall g (lambda () (throw 'a 3))) + (funcall g (lambda () (throw 'b 5))) + (funcall g (lambda () (/ 1 0))) + (funcall g (lambda () (signal 'error nil))))) + '((ok 2) (catch-a 3) (catch-b 5) + (arith (arith-error)) (err (error))))) + ) ;; Local Variables: ;; no-byte-compile: t --Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_51898DD6-0AC4-45AD-8104-17DD900FD77B-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 13 03:38:22 2021 Received: (at 47677) by debbugs.gnu.org; 13 Apr 2021 07:38:22 +0000 Received: from localhost ([127.0.0.1]:58870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWDcs-0001OU-Gz for submit@debbugs.gnu.org; Tue, 13 Apr 2021 03:38:22 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWDcq-0001OI-J0 for 47677@debbugs.gnu.org; Tue, 13 Apr 2021 03:38:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DFHxjBkMfuS/Dk+6GoZs7Z8BHCbxPDYNNxURRWPSZJQ=; b=ul462B91699l3SnAsj9Fi0tczl MM1YJ5MSwgxzv9KcwLPwtcKZdxtwgsQQFOB5yu8m3Fn3Qlth97v4pD1ssfX54eIHi01ACqUsy5ktV s4ZTZ0/elrbuVsVK+30lT3kUGeepVLog0H01bjqr6xUFFnMy/c+gvo+NgKJoEAquZhkI=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWDch-0000iE-GZ; Tue, 13 Apr 2021 09:38:13 +0200 From: Lars Ingebrigtsen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEXx6Oy8pMpvc6/d aJr///8sYALUAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UEDQceASu+R0AAAAF1SURBVDjLdZRbgoMw CEXDZAMhbKBkNiCy/70Nj2g1OqkfNofnhbYUP4itrGccpy8M7dg19vF5OAV8RjMH7H0Yud/3mYJX cib/F/C4pxkXEm74AJ3fASPfsoxLVW85mNcWT4fWXstlt28vobIasM8KwngF+8iuEQregI6sycxv APXorRUkFali78xcSPoJNM9W3LbqCZqlqULaSgRX4AwOOeUxAmBR7Jz1Ih8LEIAUsxP4yp5vauln KFANkNpVr9hcfhxsVy2ni61jWri3d+NZPL2DKf9WrR0AVPH0DkoJUyXvE0yKbpXaQ5LZUwGrLQRz RRrsnwOQEJJ1Zfcmh5kAJhAx49hiJRuOvz2A7rmVE2gIRF7Inks5ASXQCUbHK2g1vuR2z3IpZ57g d78AcRAieLxmg/x6FPcQV/rSuQQgDclTRJISQBp8QC+zoM0e3VAQuP/qd60hKUkrBmT5sdeNsJgH r/8C1bbAwXof62Hb2n3acxn+AE6tVO1qmSHXAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIxLTA0LTEz VDA3OjMwOjAxKzAwOjAwHlQbjAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wNC0xM1QwNzozMDow MSswMDowMG8JozAAAAAASUVORK5CYII= X-Now-Playing: Marianne Faithfull's _A Child's Adventure_: "Falling From Grace" Date: Tue, 13 Apr 2021 09:38:10 +0200 In-Reply-To: <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Mon, 12 Apr 2021 21:20:24 +0200") Message-ID: <87sg3uskgt.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Mattias EngdegÄrd writes: > Here is an updated patch that reduces some code duplication in the > compiler and fixes an embarrassing bug, and as a bonus, an > experimental add-on that allows catching throws in condition-case > [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd writes: > Here is an updated patch that reduces some code duplication in the > compiler and fixes an embarrassing bug, and as a bonus, an > experimental add-on that allows catching throws in condition-case > using the handler syntax > > ((:catch TAG) BODY...) I'm not quite sure I understand the use case for this -- we already have a general catch/throw infrastructure, so this sounds like a somewhat odd addition. That is, currently you know what to look for when reading code that does a throw, and this introduces a second thing to look for, and I'm not sure that's a net win. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 13 04:53:07 2021 Received: (at 47677) by debbugs.gnu.org; 13 Apr 2021 08:53:07 +0000 Received: from localhost ([127.0.0.1]:58959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWEnC-0003KE-RE for submit@debbugs.gnu.org; Tue, 13 Apr 2021 04:53:07 -0400 Received: from mail1478c50.megamailservers.eu ([91.136.14.78]:51134 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWEnA-0003Ji-1n for 47677@debbugs.gnu.org; Tue, 13 Apr 2021 04:53:04 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1618303977; bh=ZxQdbTuvt/Z3viwzJQRmxjcQgmGEqChJGcLv62911UI=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=FW0PDmAWPGtNc1FYb8mfxdCFsvKWpl/8vaQKnYcxQt1RGiUepVCEmX96rXLgUaMy5 tvN7yrF6i4Xexv1LnTfhcBwBFrLbRzXO8NXH/mkCbtTYiFCQFtEwuaiTsyCwVHLxMh IGj/C/VtlcXlhKfRPX0oStNf8P3pLFpBewjyWQog= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13D8qsI1027485; Tue, 13 Apr 2021 08:52:56 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87sg3uskgt.fsf@gnus.org> Date: Tue, 13 Apr 2021 10:52:54 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> To: Lars Ingebrigtsen X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F24.60755BE9.0033, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=J9HUEzvS c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=zSyZDcWAF_YP9qBLzdEA:9 a=CjuIK1q_8ugA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 47677 Cc: Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 13 apr. 2021 kl. 09.38 skrev Lars Ingebrigtsen : >> ((:catch TAG) BODY...) >=20 > I'm not quite sure I understand the use case for this -- we already = have > a general catch/throw infrastructure, so this sounds like a somewhat = odd > addition. Oh, it was just proof-of-concept code to show that such a generalisation = would be possible should it be desired later. It's not part of the = immediate proposal. Sorry about the confusion. Our present `catch` has the same flaw as `condition-case` in that it = does not give access to the success continuation, leading to hacks = similar to the one you mentioned. We could extend `catch` instead, maybe = like this: (catch TAG :in BODY-FORM :success VAR SUCCESS-FORM) but what if you want to catch multiple tags, or both throws and errors? = The constructs don't compose; nesting them hides the success = continuation of the inner forms. From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 14 05:29:34 2021 Received: (at 47677) by debbugs.gnu.org; 14 Apr 2021 09:29:34 +0000 Received: from localhost ([127.0.0.1]:33574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWbq2-0007dn-DN for submit@debbugs.gnu.org; Wed, 14 Apr 2021 05:29:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:43356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lWbq0-0007dZ-6e for 47677@debbugs.gnu.org; Wed, 14 Apr 2021 05:29:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vpgz2oBpmFMK4lKX6mEB2gudyoJ7FAJN4YAbzh0n6Qw=; b=X7COtc455nqYo3AFO2wulNcGWN AOEHDQGM9PIfECE707QGTlG3nW7RsDj5dkiOLBB9XSrYXam/z7R8lcV98pPLDcNERN5GfBYGNwtff swKIZmcnzpMNhskPX/Otx5T2lCEwZtAdyv0cSgoDsYB9AuWxkmvcWSztNW67ZEdAziPU=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lWbpq-0007oC-Cy; Wed, 14 Apr 2021 11:29:24 +0200 From: Lars Ingebrigtsen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> X-Now-Playing: Boris's _Absolutego Studio Session 2018_: "Absolutego" Date: Wed, 14 Apr 2021 11:29:21 +0200 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Tue, 13 Apr 2021 10:52:54 +0200") Message-ID: <87zgy1qkni.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Mattias EngdegÄrd writes: > Oh, it was just proof-of-concept code to show that such a > generalisation would be possible should it be desired later. It's not > part of the immediate proposal. Sorry about the confusion. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd writes: > Oh, it was just proof-of-concept code to show that such a > generalisation would be possible should it be desired later. It's not > part of the immediate proposal. Sorry about the confusion. Oh, OK. :-) > Our present `catch` has the same flaw as `condition-case` in that it > does not give access to the success continuation, leading to hacks > similar to the one you mentioned. Yes, that's true. > We could extend `catch` instead, maybe like this: > > (catch TAG :in BODY-FORM :success VAR SUCCESS-FORM) > > but what if you want to catch multiple tags, or both throws and > errors? The constructs don't compose; nesting them hides the success > continuation of the inner forms. Yeah, I think extending `catch' here would be less than optimal, but I don't really have any suggestions here -- I use `throw/catch' so little that I have no gut feeling about what I see as being useful. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 15 09:54:41 2021 Received: (at 47677) by debbugs.gnu.org; 15 Apr 2021 13:54:41 +0000 Received: from localhost ([127.0.0.1]:36941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX2S9-0001NW-6N for submit@debbugs.gnu.org; Thu, 15 Apr 2021 09:54:41 -0400 Received: from mail1433c50.megamailservers.eu ([91.136.14.33]:40806 helo=mail263c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX2S7-0001NH-3i for 47677@debbugs.gnu.org; Thu, 15 Apr 2021 09:54:40 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1618494872; bh=xhSm+N96z6TR2u02j3T8fNAkFmYQSylntWpLaLXlY/I=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=igq2/Rsu7TgtFjG7L4fTwPRxLC99Ye26JAndPp2e0/j1xR3HTIFwdquYJbVmOa0Aj 5BmQzTRT6oAjHkbeb6yqWfl6n5AA6NqP/SETDzl0OOeC9fugIck1Y/kRdbLrmEjaAq FzHtQcQ3ftDKcd3IMz3JJnCbnRDwl6VpiPMmuA3k= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13FDsT9R031703; Thu, 15 Apr 2021 13:54:31 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87zgy1qkni.fsf@gnus.org> Date: Thu, 15 Apr 2021 15:54:27 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> To: Lars Ingebrigtsen X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F24.60784598.0042, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=LMMYv6e9 c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=oh22u8Ri8_uITisE-bcA:9 a=CjuIK1q_8ugA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 14 apr. 2021 kl. 11.29 skrev Lars Ingebrigtsen : > Yeah, I think extending `catch' here would be less than optimal, but I > don't really have any suggestions here -- I use `throw/catch' so little > that I have no gut feeling about what I see as bein [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 47677 Cc: Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 14 apr. 2021 kl. 11.29 skrev Lars Ingebrigtsen : > Yeah, I think extending `catch' here would be less than optimal, but I > don't really have any suggestions here -- I use `throw/catch' so = little > that I have no gut feeling about what I see as being useful. It's unfortunate that elisp has two incompatible variants, throw/catch = and signal/condition-case, of essentially the same control structure. In = practice throw/catch tends to be used more for non-error situations, but = that's just a matter of style -- the underlying mechanisms are basically = the same. In any case the patch apparently wasn't bad enough to be rejected = outright so it's boldly been pushed to master. If the general opinion is = that :no-error (or something else) would be a better name than :success, = I'll make the change in a blink. I didn't do any serious search for places where the new construct would = be profitably employed but there are bound to be a few. Have a look at = `load-completions-from-file`, for example. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 16 01:13:40 2021 Received: (at 47677) by debbugs.gnu.org; 16 Apr 2021 05:13:40 +0000 Received: from localhost ([127.0.0.1]:39893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXGnU-0007nJ-2k for submit@debbugs.gnu.org; Fri, 16 Apr 2021 01:13:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXGnR-0007n1-SF for 47677@debbugs.gnu.org; Fri, 16 Apr 2021 01:13:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51336) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXGnM-0008O1-3M; Fri, 16 Apr 2021 01:13:32 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lXGnK-0008QH-PP; Fri, 16 Apr 2021 01:13:30 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= on Thu, 15 Apr 2021 15:54:27 +0200) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> Message-Id: Date: Fri, 16 Apr 2021 01:13:30 -0400 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > It's unfortunate that elisp has two incompatible variants, > throw/catch and signal/condition-case, of essentially the same > control structure. It's not unfortunate, it's normal. Other Lisp dialects have them both, too. There is a good reason for this: errors can invoke the debugger. -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 16 01:13:44 2021 Received: (at 47677) by debbugs.gnu.org; 16 Apr 2021 05:13:44 +0000 Received: from localhost ([127.0.0.1]:39896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXGnY-0007nd-AO for submit@debbugs.gnu.org; Fri, 16 Apr 2021 01:13:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lXGnW-0007n9-Ab for 47677@debbugs.gnu.org; Fri, 16 Apr 2021 01:13:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51337) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXGnQ-0008Qw-Hf; Fri, 16 Apr 2021 01:13:36 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lXGnN-0008QT-6Q; Fri, 16 Apr 2021 01:13:34 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= on Thu, 15 Apr 2021 15:54:27 +0200) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> Message-Id: Date: Fri, 16 Apr 2021 01:13:33 -0400 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > It's unfortunate that elisp has two incompatible variants, > throw/catch and signal/condition-case, of essentially the same > control structure. It's not unfortunate, it's normal. Other Lisp dialects have them both, too. There is a good reason for this: errors can invoke the debugger. Emacs Lisp is not Scheme. Does continuation-passing style work usably in Emacs Lisp now? I don't know for certain, but I would be very surprised. If not, let's keep things simple by not trying to define constructs for that. That simplicity is very important. -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 19 03:38:58 2021 Received: (at control) by debbugs.gnu.org; 19 Apr 2021 07:38:58 +0000 Received: from localhost ([127.0.0.1]:48285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYOUk-0004Wy-0U for submit@debbugs.gnu.org; Mon, 19 Apr 2021 03:38:58 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:35563) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYOUi-0004Wl-Qu for control@debbugs.gnu.org; Mon, 19 Apr 2021 03:38:57 -0400 Received: by mail-pj1-f45.google.com with SMTP id j21-20020a17090ae615b02901505b998b45so4526220pjy.0 for ; Mon, 19 Apr 2021 00:38:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:date:message-id:subject:to; bh=DnwK8I3ocyl36/gLv7WB9jea+b6W6fkhEouWl1GCObY=; b=cGv8qNe8cZPPf1PduAk71Y0MlFpveSBlt1ABLOIWv4I5zo8bJ0kmb+3XYolp48R5be wsfO4rb1m+WR0YqVsd/MyY0R2FGVwIxcduDXkcGe3gsaGsx0flt524NyOpWBd6nXJGwS 4brNhS2xxDFNAQq2JOclnVCZJk0sS598i6ZZ+2UqY5rw4dhkD3bSOJp/EXgeLf8a59Lv PgfI+SxT4sR9ngDoO4Z7LSeAq76lXdRNa5xeodw2LnritbuCYBIxMMtSvIGeOlpO6rmn wO+lnLIulyd+oz7sCzAX8fwwJKQO4lwXDoKNc9dta811HWzklgcSar/xDLTi4O1m5AX/ Cm4g== X-Gm-Message-State: AOAM531sJu6k7KZUHPd0LAULAh9GZZyFKvWLWrwe7GZ8HdQI0bUH+/pq jfPgoGmdlwZTIdVrTzAzEMp7wwpAJ368d4pU1Srpj8Eg X-Google-Smtp-Source: ABdhPJwUodEfqqhfLK98bVlSm5dHX5uof0H8SEkWJLzhGBgpu9+kfnnW/hFLumvM28LkljxJi0XB81L/ex6OuOMTRtM= X-Received: by 2002:a17:90b:19ca:: with SMTP id nm10mr23890059pjb.175.1618817931266; Mon, 19 Apr 2021 00:38:51 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 19 Apr 2021 07:38:50 +0000 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 19 Apr 2021 07:38:50 +0000 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 47881 minor severity 47878 wishlist severity 47876 wishlist severity 47862 minor severity 47785 minor severity 47738 minor severity 47686 wishlist severity 47677 wishlist thanks Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.216.45 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.216.45 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 BLANK_SUBJECT Subject is present but empty -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 47881 minor severity 47878 wishlist severity 47876 wishlist severity 47862 minor severity 47785 minor severity 47738 minor severity 47686 wishlist severity 47677 wishlist thanks Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.216.45 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.216.45 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 BLANK_SUBJECT Subject is present but empty -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines severity 47881 minor severity 47878 wishlist severity 47876 wishlist severity 47862 minor severity 47785 minor severity 47738 minor severity 47686 wishlist severity 47677 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 21 10:13:24 2021 Received: (at 47677) by debbugs.gnu.org; 21 Apr 2021 14:13:24 +0000 Received: from localhost ([127.0.0.1]:59316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZDbY-0002Wp-6T for submit@debbugs.gnu.org; Wed, 21 Apr 2021 10:13:24 -0400 Received: from mail-pl1-f171.google.com ([209.85.214.171]:37776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZDbW-0002WX-0b for 47677@debbugs.gnu.org; Wed, 21 Apr 2021 10:13:22 -0400 Received: by mail-pl1-f171.google.com with SMTP id h20so21723534plr.4 for <47677@debbugs.gnu.org>; Wed, 21 Apr 2021 07:13:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc :content-transfer-encoding; bh=8O7Xnibxj+MiteTGvhs3z1L6XnP5yuhzXe8plxZya80=; b=P3tzHFudf2ToiYy3xy42BCVl1pRGFezB+NWGHG7hTpTx88NIyJWDHHkXaln3mHicVP U7+9OxXcXqIKtvYCK1oCLEC1s4y8ifJPO0ScOA2Yz2Yo9+fgnG1hwhpy9YWoOyWtEiHT LZNDYrMDz4kLvTw2ElXHIgVe9fbLOzt+GRkebJiy6NLg4VbC0+1SNEE4nHS/re2ufIc+ blix7aQSc9XCu7ziTIEoVfSv8LNQz+JE/DIFKNgu/khhvA6+c+YA9DihJqbX/RhaJ56m VBJi2vwq7OUbAWQWxP8sklu/A4pnitypqmPtb1gY3sZPQqP0z0L4ko11m6MN0V4Kyjkl ELHg== X-Gm-Message-State: AOAM531VvWSc0K4g6mPmc4EUxX/t+kvVEyidAeyf+OGJuKJ3y6CqwJoH Nf+qP4BhirvSmkzxi+i8qUki4o2kD/hoLVtqb6I= X-Google-Smtp-Source: ABdhPJyB102txkRNbu82LVBPs+PScw10Uo+mjEpTtMzQcx6J58+3HISCTEif33JmsPvd5DAA89TOHI1gc5dDGtRIzdY= X-Received: by 2002:a17:902:7788:b029:e9:11:5334 with SMTP id o8-20020a1709027788b02900e900115334mr34116125pll.70.1619014396414; Wed, 21 Apr 2021 07:13:16 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 21 Apr 2021 09:13:16 -0500 From: Stefan Kangas In-Reply-To: =?UTF-8?B?PEYwNEYzMjUwLUYyRTItNENEOC1BRERGLTI3MkU0OUI4MkE2NkBhY20ub3JnPiAo?= =?UTF-8?B?Ik1hdHRpYXMgRW5nZGVnw6VyZCIncyBtZXNzYWdlIG9mICJUaHUsIDE1IEFwciAyMDIxIDE1OjU0OjI3?= =?UTF-8?B?ICswMjAwIik=?= References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Date: Wed, 21 Apr 2021 09:13:16 -0500 Message-ID: Subject: Re: bug#47677: [PATCH] condition-case success continuation To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 47677 Cc: Lars Ingebrigtsen , Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Mattias Engdeg=C3=A5rd writes: > 14 apr. 2021 kl. 11.29 skrev Lars Ingebrigtsen : > >> Yeah, I think extending `catch' here would be less than optimal, but I >> don't really have any suggestions here -- I use `throw/catch' so little >> that I have no gut feeling about what I see as being useful. > > It's unfortunate that elisp has two incompatible variants, throw/catch an= d > signal/condition-case, of essentially the same control structure. In prac= tice > throw/catch tends to be used more for non-error situations, but that's ju= st a > matter of style -- the underlying mechanisms are basically the same. > > In any case the patch apparently wasn't bad enough to be rejected outrigh= t so > it's boldly been pushed to master. If the general opinion is that :no-err= or (or > something else) would be a better name than :success, I'll make the chang= e in a > blink. > > I didn't do any serious search for places where the new construct > would be profitably employed but there are bound to be a few. Have a > look at `load-completions-from-file`, for example. It seems like the patch here was pushed. Should this be closed, or is there more to do here? From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 22 09:58:17 2021 Received: (at 47677) by debbugs.gnu.org; 22 Apr 2021 13:58:17 +0000 Received: from localhost ([127.0.0.1]:35200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZZqT-0001ig-0N for submit@debbugs.gnu.org; Thu, 22 Apr 2021 09:58:17 -0400 Received: from mail173c50.megamailservers.eu ([91.136.10.183]:38858 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZZqR-0001iY-HV for 47677@debbugs.gnu.org; Thu, 22 Apr 2021 09:58:16 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1619099893; bh=cPx7cxDgHPU5FlOgM/93gTQIw3Eqrl6zCUndj517B8A=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=aQ6gEkHY8Qo3gN0oY8Zfo10CTyreEpFMbe6i2+HLyUMXCiiX9AJHbbK8aWUQSBJEr YDk6vdyVjNRCVeMU41ymUkvJqMJUHLKyAna0RwOdmbKX31xGlVpZgxTFebrNOFfcY9 RSxVBnS3VdCQsTEYFfu+78/wBT/33qFvdMXPkIxY= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13MDwBTm026308; Thu, 22 Apr 2021 13:58:12 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_46565640-A5B4-47B1-93EE-1B08F34AD9DE" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation Date: Thu, 22 Apr 2021 15:58:10 +0200 In-Reply-To: To: Stefan Kangas References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1F.608180F5.003E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=FblJO626 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=GzfwrDjxe7EOOWsxUE0A:9 a=CjuIK1q_8ugA:10 a=weKScdL88ZS-fUvzyssA:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 47677 Cc: Lars Ingebrigtsen , Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_46565640-A5B4-47B1-93EE-1B08F34AD9DE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 21 apr. 2021 kl. 16.13 skrev Stefan Kangas : > Should this be closed, or is there more to do here? There's the business of fixing `catch` in the same way. (A new bug could = be opened for it, but since it's intimately related we might as well do = it here.) As mentioned, `catch` has three problems: - no way to execute code when a throw is caught - no way to execute code when the body terminates normally - no way to catch both throws and errors since neither `catch` nor `condition-case` compose with themselves or = each other. For example, it would be useful to have `pcase` match both the value of = an expression as well as throws and errors from it. Here is a proper patch, essentially a polished version of the previously = posted diff. It adds `condition-case` clauses on the form ((:catch TAG-EXPR) BODY...) where TAG-EXPR is evaluated before the protected form to a tag value, = and BODY is executed when that tag is thrown, with the variable bound to = the thrown value. --Apple-Mail=_46565640-A5B4-47B1-93EE-1B08F34AD9DE Content-Disposition: attachment; filename=0001-catch-handlers-in-condition-case-bug-47677.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-catch-handlers-in-condition-case-bug-47677.patch" Content-Transfer-Encoding: quoted-printable =46rom=20218db91619430d0f26ca3e17839e6669fd291e76=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2012=20Apr=202021=2020:40:23=20+0200=0A= Subject:=20[PATCH]=20`catch`=20handlers=20in=20`condition-case`=20= (bug#47677)=0A=0AAdd=20handlers=20on=20the=20form=0A=0A=20=20((:catch=20= TAG)=20BODY...)=0A=0Awhere=20TAG=20is=20an=20expression=20that=20is=20= evaluated=20prior=20to=20the=20protected=0Aform=20and=20yields=20a=20= catch=20tag=20that=20is=20handled=20by=20BODY=20with=20the=20variable=0A= bound=20to=20the=20thrown=20value.=20=20For=20example,=0A=0A=20=20= (condition-case=20x=0A=20=20=20=20=20=20(throw=20'meep=202)=0A=20=20=20=20= ((:catch=20'meep)=20(+=20x=203)))=0A=20=20=3D>=205=0A=0AMultiple=20catch=20= and=20error=20handlers=20can=20be=20mixed=20freely=20in=20the=20same=0A= `condition-case`=20form,=20which=20can=20also=20include=20a=20:success=20= clause.=0A=0AIn=20other=20words,=20this=20change=20remedies=20three=20= problems:=20`catch`=20lacking=0Aseparate=20code=20branches=20for=20the=20= throw=20and=20fall-through=20cases,=20and=20the=0Alack=20of=20= composability=20with=20`condition-case`=20and=20`catch`.=0A=0A*=20= src/eval.c=20(internal_lisp_condition_case,=20syms_of_eval):=20Implement=0A= in=20interpreter.=0A*=20lisp/emacs-lisp/cconv.el=20(cconv-convert,=20= cconv-analyze-form):=0A*=20lisp/emacs-lisp/bytecomp.el=20= (byte-compile-condition-case):=20Implement=0Ain=20byte-compiler.=0A*=20= test/lisp/emacs-lisp/bytecomp-tests.el=20(bytecomp-tests--test-cases)=0A= (bytecomp-condition-case-success):=20Add=20tests.=0A---=0A=20= lisp/emacs-lisp/bytecomp.el=20=20=20=20=20=20=20=20=20=20=20=20|=2044=20= ++++++++-----=0A=20lisp/emacs-lisp/cconv.el=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20|=2024=20++++---=0A=20src/eval.c=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=2027=20= +++++++-=0A=20test/lisp/emacs-lisp/bytecomp-tests.el=20|=2091=20= +++++++++++++++++++++++++-=0A=204=20files=20changed,=20158=20= insertions(+),=2028=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/emacs-lisp/bytecomp.el=20b/lisp/emacs-lisp/bytecomp.el=0Aindex=20= 4f91f0d5de..82e0edd772=20100644=0A---=20a/lisp/emacs-lisp/bytecomp.el=0A= +++=20b/lisp/emacs-lisp/bytecomp.el=0A@@=20-4636,22=20+4636,34=20@@=20= byte-compile-condition-case=0A=20=20=20=20=20=20=20(byte-compile-warn=0A=20= =20=20=20=20=20=20=20"`%s'=20is=20not=20a=20variable-name=20or=20nil=20= (in=20condition-case)"=20var))=0A=20=0A-=20=20=20=20(dolist=20(clause=20= (reverse=20clauses))=0A-=20=20=20=20=20=20(let=20((condition=20(nth=201=20= clause)))=0A-=20=20=20=20=20=20=20=20(unless=20(consp=20condition)=20= (setq=20condition=20(list=20condition)))=0A-=20=20=20=20=20=20=20=20= (dolist=20(c=20condition)=0A-=20=20=20=20=20=20=20=20=20=20(unless=20= (and=20c=20(symbolp=20c))=0A-=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-warn=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20"`%S'=20is=20= not=20a=20condition=20name=20(in=20condition-case)"=20c))=0A-=20=20=20=20= =20=20=20=20=20=20;;=20In=20reality,=20the=20`error-conditions'=20= property=20is=20only=20required=0A-=20=20=20=20=20=20=20=20=20=20;;=20= for=20the=20argument=20to=20`signal',=20not=20to=20`condition-case'.=0A-=20= =20=20=20=20=20=20=20=20=20;;(unless=20(consp=20(get=20c=20= 'error-conditions))=0A-=20=20=20=20=20=20=20=20=20=20;;=20=20= (byte-compile-warn=0A-=20=20=20=20=20=20=20=20=20=20;;=20=20=20"`%s'=20= is=20not=20a=20known=20condition=20name=20(in=20condition-case)"=0A-=20=20= =20=20=20=20=20=20=20=20;;=20=20=20c))=0A-=20=20=20=20=20=20=20=20=20=20= )=0A-=20=20=20=20=20=20=20=20(byte-compile-push-constant=20condition))=0A= -=20=20=20=20=20=20(byte-compile-goto=20'byte-pushconditioncase=20(car=20= clause)))=0A+=20=20=20=20(let=20((initial-depth=20byte-compile-depth)=0A= +=20=20=20=20=20=20=20=20=20=20(push-ops=20nil))=0A+=20=20=20=20=20=20;;=20= Push=20all=20conditions=20and=20tags=20in=20left-to-right=20order=20= first,=0A+=20=20=20=20=20=20;;=20since=20tags=20need=20to=20be=20= evaluated=20outside=20the=20scope=20of=20the=20handlers.=0A+=20=20=20=20=20= =20(dolist=20(clause=20clauses)=0A+=20=20=20=20=20=20=20=20(let=20= ((condition=20(nth=201=20clause)))=0A+=20=20=20=20=20=20=20=20=20=20= (pcase=20condition=0A+=20=20=20=20=20=20=20=20=20=20=20=20(`(:catch=20= ,tag-expr)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(byte-compile-form=20= tag-expr)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(push=20(cons=20= 'byte-pushcatch=20(car=20clause))=20push-ops))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20(`(:catch=20.=20,_)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= (error=20"malformed=20:catch=20clause:=20`%S'"=20(cdr=20clause)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20(_=20=20=20=20=20=20=20=20=20=20=20=20=20;=20= error=20clause=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(unless=20= (consp=20condition)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (setq=20condition=20(list=20condition)))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20(dolist=20(c=20condition)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(unless=20(and=20c=20(symbolp=20c))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(byte-compile-warn=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20"`%S'=20is=20not=20a=20condition=20name=20(in=20= condition-case)"=20c)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= (byte-compile-push-constant=20condition)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20(push=20(cons=20'byte-pushconditioncase=20(car=20clause))=20= push-ops)))))=0A+=20=20=20=20=20=20;;=20Then=20emit=20the=20handler=20= activations=20in=20reverse=20order=20so=20that=20the=0A+=20=20=20=20=20=20= ;;=20first=20handler=20becomes=20the=20innermost.=0A+=20=20=20=20=20=20= (dolist=20(op=20push-ops)=0A+=20=20=20=20=20=20=20=20;;=20Use=20the=20= depth=20at=20which=20the=20jumps=20will=20take=20place=20in=20the=20tag.=0A= +=20=20=20=20=20=20=20=20(setq=20byte-compile-depth=20(1+=20= initial-depth))=0A+=20=20=20=20=20=20=20=20(byte-compile-goto=20(car=20= op)=20(cdr=20op)))=0A+=20=20=20=20=20=20(cl-assert=20(equal=20= byte-compile-depth=20initial-depth)))=0A=20=0A=20=20=20=20=20= (byte-compile-form=20body)=20;;=20byte-compile--for-effect=0A=20=20=20=20= =20(dolist=20(_=20clauses)=20(byte-compile-out=20'byte-pophandler))=0A= diff=20--git=20a/lisp/emacs-lisp/cconv.el=20b/lisp/emacs-lisp/cconv.el=0A= index=20f663710902..f92f9b7ed8=20100644=0A---=20= a/lisp/emacs-lisp/cconv.el=0A+++=20b/lisp/emacs-lisp/cconv.el=0A@@=20= -510,14=20+510,18=20@@=20cconv-convert=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20newprotform)=0A=20=20=20=20=20=20=20=20=20=20=20,@(mapcar=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(lambda=20(handler)=0A-=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20`(,(car=20handler)=0A-=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20,@(let=20((body=0A-=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(mapcar=20= (lambda=20(form)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cconv-convert=20= form=20newenv=20extend))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cdr=20= handler))))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(if=20(not=20(eq=20class=20:captured+mutated))=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20body=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20`((let=20((,var=20= (list=20,var)))=20,@body))))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(let=20((head=20(pcase=20(car=20handler)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(`(:catch=20= ,tag-exp)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20`(:catch=20,(cconv-convert=20tag-exp=20env=20= extend)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(h=20h))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20`(,head=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20,@(let=20((body=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(mapcar=20(lambda=20(form)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(cconv-convert=20form=20newenv=20= extend))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cdr=20handler))))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= (not=20(eq=20class=20:captured+mutated))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20body=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20`((let=20= ((,var=20(list=20,var)))=20,@body)))))))=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20handlers))))=0A=20=0A=20=20=20=20=20(`(unwind-protect=20= ,form=20.=20,body)=0A@@=20-736,6=20+740,10=20@@=20cconv-analyze-form=0A=20= =20=20=20=20(`(function=20.=20,_)=20nil)=20=20=20=20=20=20=20=20=20=20=20= =20=20=20;=20same=20as=20quote=0A=20=0A=20=20=20=20=20(`(condition-case=20= ,var=20,protected-form=20.=20,handlers)=0A+=20=20=20=20=20(dolist=20= (handler=20handlers)=0A+=20=20=20=20=20=20=20(pcase=20handler=0A+=20=20=20= =20=20=20=20=20=20(`((:catch=20,tag-exp)=20.=20,_)=0A+=20=20=20=20=20=20=20= =20=20=20(cconv-analyze-form=20tag-exp=20env))))=0A=20=20=20=20=20=20= (cconv-analyze-form=20protected-form=20env)=0A=20=20=20=20=20=20(when=20= (and=20var=20(symbolp=20var)=20(byte-compile-not-lexical-var-p=20var))=0A= =20=20=20=20=20=20=20=20(byte-compile-warn=0Adiff=20--git=20a/src/eval.c=20= b/src/eval.c=0Aindex=20fd93f5b9e1..d4ed746458=20100644=0A---=20= a/src/eval.c=0A+++=20b/src/eval.c=0A@@=20-1351,6=20+1351,7=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=20=20CHECK_SYMBOL=20(var);=0A=20=0A=20=20=20Lisp_Object=20= success_handler=20=3D=20Qnil;=0A+=20=20Lisp_Object=20tags=20=3D=20Qnil;=09= /*=20Evaluated=20catch=20tags=20in=20reverse=20order.=20*/=0A=20=0A=20=20= =20for=20(Lisp_Object=20tail=20=3D=20handlers;=20CONSP=20(tail);=20tail=20= =3D=20XCDR=20(tail))=0A=20=20=20=20=20{=0A@@=20-1361,10=20+1362,21=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=09=09=20=20=20=20=20||=20CONSP=20(XCAR=20(tem))))))=0A=20= =09error=20("Invalid=20condition=20handler:=20%s",=0A=20=09=20=20=20=20=20= =20=20SDATA=20(Fprin1_to_string=20(tem,=20Qt)));=0A-=20=20=20=20=20=20if=20= (EQ=20(XCAR=20(tem),=20QCsuccess))=0A+=20=20=20=20=20=20Lisp_Object=20= head=20=3D=20XCAR=20(tem);=0A+=20=20=20=20=20=20if=20(EQ=20(head,=20= QCsuccess))=0A=20=09success_handler=20=3D=20XCDR=20(tem);=0A=20=20=20=20=20= =20=20else=0A-=09clausenb++;=0A+=09{=0A+=09=20=20if=20(CONSP=20(head)=20= &&=20EQ=20(XCAR=20(head),=20QCcatch))=0A+=09=20=20=20=20{=0A+=09=20=20=20= =20=20=20if=20(NILP=20(XCDR=20(head))=20||=20!NILP=20(XCDR=20(XCDR=20= (head))))=0A+=09=09error=20("Invalid=20catch=20handler:=20%s",=0A+=09=09=20= =20=20=20=20=20=20SDATA=20(Fprin1_to_string=20(tem,=20Qt)));=0A+=09=20=20= =20=20=20=20Lisp_Object=20tag=20=3D=20eval_sub=20(XCAR=20(XCDR=20= (head)));=0A+=09=20=20=20=20=20=20tags=20=3D=20Fcons=20(tag,=20tags);=0A= +=09=20=20=20=20}=0A+=09=20=20clausenb++;=0A+=09}=0A=20=20=20=20=20}=0A=20= =0A=20=20=20/*=20The=20first=20clause=20is=20the=20one=20that=20should=20= be=20checked=20first,=20so=20it=0A@@=20-1386,7=20+1398,15=20@@=20= internal_lisp_condition_case=20(Lisp_Object=20var,=20Lisp_Object=20= bodyform,=0A=20=20=20=20=20=20=20Lisp_Object=20condition=20=3D=20CONSP=20= (clause)=20?=20XCAR=20(clause)=20:=20Qnil;=0A=20=20=20=20=20=20=20if=20= (!CONSP=20(condition))=0A=20=09condition=20=3D=20list1=20(condition);=0A= -=20=20=20=20=20=20struct=20handler=20*c=20=3D=20push_handler=20= (condition,=20CONDITION_CASE);=0A+=20=20=20=20=20=20struct=20handler=20= *c;=0A+=20=20=20=20=20=20if=20(EQ=20(XCAR=20(condition),=20QCcatch))=0A+=09= {=0A+=09=20=20Lisp_Object=20tag=20=3D=20XCAR=20(tags);=0A+=09=20=20tags=20= =3D=20XCDR=20(tags);=0A+=09=20=20c=20=3D=20push_handler=20(tag,=20= CATCHER);=0A+=09}=0A+=20=20=20=20=20=20else=0A+=09c=20=3D=20push_handler=20= (condition,=20CONDITION_CASE);=0A=20=20=20=20=20=20=20if=20(sys_setjmp=20= (c->jmp))=0A=20=09{=0A=20=09=20=20Lisp_Object=20val=20=3D=20= handlerlist->val;=0A@@=20-4409,6=20+4429,7=20@@=20syms_of_eval=20(void)=0A= =20=20=20defsubr=20(&Sunwind_protect);=0A=20=20=20defsubr=20= (&Scondition_case);=0A=20=20=20DEFSYM=20(QCsuccess,=20":success");=0A+=20= =20DEFSYM=20(QCcatch,=20":catch");=0A=20=20=20defsubr=20(&Ssignal);=0A=20= =20=20defsubr=20(&Scommandp);=0A=20=20=20defsubr=20(&Sautoload);=0Adiff=20= --git=20a/test/lisp/emacs-lisp/bytecomp-tests.el=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0Aindex=20= c9ab3ec1f1..fb123ab600=20100644=0A---=20= a/test/lisp/emacs-lisp/bytecomp-tests.el=0A+++=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0A@@=20-503,6=20+503,46=20@@=20= bytecomp-tests--test-cases=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(:success=20'good))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(1+=20x))))=0A=20=20=20=20=20=20=20(funcall=20f=203))=0A+=0A+=20=20= =20=20;;=20Catching=20throws,=20simple.=0A+=20=20=20=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20(throw=20'z=207)=0A+=20=20=20=20=20=20= ((:catch=20'z)=20(list=20'got-z=20x)))=0A+=20=20=20=20(condition-case=20= x=0A+=20=20=20=20=20=20=20=20(list=208)=0A+=20=20=20=20=20=20((:catch=20= 'z)=20(list=20'got-z=20x)))=0A+=0A+=20=20=20=20;;=20Catching=20throws.=0A= +=20=20=20=20(let=20((g=20(lambda=20(f)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(let=20((tags=20(list=20'a=20'b)))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20f)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20= tags)=20(setq=20tags=20(cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(list=20'catch-a=20x))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20tags)=20= (setq=20tags=20(cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(list=20'catch-b=20x))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(:success=20(list=20'ok=20x)))))))=0A+=20=20= =20=20=20=20(list=20(funcall=20g=20(lambda=20()=202))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(throw=20'a=203)))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(throw=20= 'b=205)))))=0A+=0A+=20=20=20=20;;=20Catching=20throws=20and=20errors.=0A= +=20=20=20=20(let=20((g=20(lambda=20(f)=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(let=20((tags=20(list=20'a=20'b)))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20f)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20= tags)=20(setq=20tags=20(cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(list=20'catch-a=20x))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(arith-error=20(list=20'arith=20x))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20= (prog1=20(car=20tags)=20(setq=20tags=20(cdr=20tags))))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20'catch-b=20x))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20(list=20= 'err=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (:success=20(list=20'ok=20x)))))))=0A+=20=20=20=20=20=20(list=20(funcall=20= g=20(lambda=20()=202))=0A+=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20= g=20(lambda=20()=20(throw=20'a=203)))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20(funcall=20g=20(lambda=20()=20(throw=20'b=205)))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(/=201=200)))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(signal=20= 'error=20nil)))))=0A=20=20=20=20=20)=0A=20=20=20"List=20of=20expressions=20= for=20cross-testing=20interpreted=20and=20compiled=20code.")=0A=20=0A@@=20= -1310,7=20+1350,56=20@@=20bytecomp-condition-case-success=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(:success=20'good))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(1+=20x))))=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20f=203))=0A-=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=204)))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=204))=0A+=0A+=20=20;;=20Catching=20throws,=20= simple.=0A+=20=20(should=20(equal=20(condition-case=20x=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(throw=20'z=207)=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20'z)=20= (list=20'got-z=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20'(got-z=207)))=0A+=0A+=20=20(should=20(equal=20(condition-case=20x=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20= 8)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20= 'z)=20(list=20'got-z=20x)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20'(8)))=0A+=0A+=20=20;;=20Catching=20throws.=0A+=20=20(should=20= (equal=0A+=20=20=20=20=20=20=20=20=20=20=20(let=20((g=20(lambda=20(f)=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20= ((tags=20(list=20'a=20'b)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(condition-case=20x=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20= f)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20((:catch=20(prog1=20(car=20tags)=20(setq=20tags=20(cdr=20= tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(list=20'catch-a=20x))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20= tags)=20(setq=20tags=20(cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(list=20'catch-b=20x))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(:success=20(list=20'ok=20x)))))))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20(list=20(funcall=20g=20(lambda=20()=202))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(throw=20= 'a=203)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (funcall=20g=20(lambda=20()=20(throw=20'b=205)))))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20'((ok=202)=20(catch-a=203)=20(catch-b=20= 5))))=0A+=0A+=20=20;;=20Catching=20throws=20and=20errors.=0A+=20=20= (should=20(equal=0A+=20=20=20=20=20=20=20=20=20=20=20(let=20((g=20= (lambda=20(f)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(let=20((tags=20(list=20'a=20'b)))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(condition-case=20x=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(funcall=20f)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20tags)=20(setq=20tags=20= (cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(list=20'catch-a=20x))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(arith-error=20= (list=20'arith=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20((:catch=20(prog1=20(car=20tags)=20(setq=20= tags=20(cdr=20tags))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(list=20'catch-b=20x))=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20= (list=20'err=20x))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(:success=20(list=20'ok=20x)))))))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20(list=20(funcall=20g=20(lambda=20()=202))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20g=20= (lambda=20()=20(throw=20'a=203)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(funcall=20g=20(lambda=20()=20(throw=20'b=205)))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20g=20= (lambda=20()=20(/=201=200)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(funcall=20g=20(lambda=20()=20(signal=20'error=20nil)))))=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'((ok=202)=20= (catch-a=203)=20(catch-b=205)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(arith=20(arith-error))=20(err=20(error)))))=0A+=20=20)=0A= =20=0A=20;;=20Local=20Variables:=0A=20;;=20no-byte-compile:=20t=0A--=20=0A= 2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_46565640-A5B4-47B1-93EE-1B08F34AD9DE-- From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 23 00:18:16 2021 Received: (at 47677) by debbugs.gnu.org; 23 Apr 2021 04:18:16 +0000 Received: from localhost ([127.0.0.1]:35949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZnGh-0001mO-ME for submit@debbugs.gnu.org; Fri, 23 Apr 2021 00:18:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZnGf-0001m9-5X for 47677@debbugs.gnu.org; Fri, 23 Apr 2021 00:18:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34260) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZnGZ-00047P-60; Fri, 23 Apr 2021 00:18:07 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lZnGY-0003BC-5u; Fri, 23 Apr 2021 00:18:06 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= on Thu, 22 Apr 2021 15:58:10 +0200) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> Message-Id: Date: Fri, 23 Apr 2021 00:18:06 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > There's the business of fixing `catch` in the same way. (A new bug could be opened for it, but since it's intimately related we might as well do it here.) As mentioned, `catch` has three problems: > - no way to execute code when a throw is caught > - no way to execute code when the body terminates normally > - no way to catch both throws and errors I do not agree that these are problems. catch and throw are ok as they are, and we should leave them alone. catch is meant for intentional exits, and condition-case is meant for catching errors. If you want to handle both in one place, use both constructs there. If you want to do something after catch catches a throw, it is not hard to implement that using the existing constructs. (if (catch 'foo (prog1 nil ...do stuff...)) ;; use (throw 'foo t) to exit do-if-throw do-if-no-throw) given how rarely this is used, it's as easy as it needs to be, and avoids making catch complicated. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 24 13:02:24 2021 Received: (at 47677) by debbugs.gnu.org; 24 Apr 2021 17:02:24 +0000 Received: from localhost ([127.0.0.1]:41379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laLfj-00025t-L0 for submit@debbugs.gnu.org; Sat, 24 Apr 2021 13:02:24 -0400 Received: from mail1433c50.megamailservers.eu ([91.136.14.33]:50322 helo=mail263c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laLfd-00025T-7C for 47677@debbugs.gnu.org; Sat, 24 Apr 2021 13:02:21 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1619283730; bh=SLyn4X6Bpul+RTpV0XEKgG+PdQs8BCKRLsC0FG96ZaI=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=cS072YZSA7VfYFjwFLXaflZUzJ4LkKOtlAPXOhPjxlAsA6S2/GnnpsPU5x120ej6Z GhEbPtuy7XAzAxNPCc/fRiAUv8oPw10UmcnjrNhhEyNG8qA809fRMAYP4heHdU+dCY ESK2nNyhER7X8w07N6PVIJMf5V/88GfRTjWGBC5s= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13OH27Uq002449; Sat, 24 Apr 2021 17:02:09 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Sat, 24 Apr 2021 19:02:07 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> To: Richard Stallman X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F20.60844F12.004C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=LMMYv6e9 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=8-HhnExR7SEaPYK0n_8A:9 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Origin-Country: SE X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 23 apr. 2021 kl. 06.18 skrev Richard Stallman : > catch and throw are ok > as they are, and we should leave them alone. And so we do! All we do here is to fill a few gaps in the system, but if = you don't feel the need for it then you can just ignore that the new = construct exist. See the previous discussion for examples, but your code is also a good = illustration: > (if (catch 'foo > (prog1 nil > ...do stuff...)) ;; use (throw 'foo t) to exit > do-if-throw > do-if-no-throw) Here the throw transmits no useful value at all; if it did, this value = would have to be restricted in some way, such as being non-nil. The Lisp = implementation knows very well whether a throw occurred or not, so we = can expose that information instead of having the user hack around the = limitation. Common uses of catch/throw include early exits from deep searches when a = match is found, and then it is useful that the thrown value is = unrestricted. Conversely, when `throw` is used to indicate a failure, it = is useful to have the normal return value unrestricted. The patch does not include the required documentation changes; naturally = that will be remedied. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 25 00:44:42 2021 Received: (at 47677) by debbugs.gnu.org; 25 Apr 2021 04:44:42 +0000 Received: from localhost ([127.0.0.1]:41845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laWdO-00040I-79 for submit@debbugs.gnu.org; Sun, 25 Apr 2021 00:44:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laWdJ-000404-5C for 47677@debbugs.gnu.org; Sun, 25 Apr 2021 00:44:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60407) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laWdD-0007Py-1I; Sun, 25 Apr 2021 00:44:31 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1laWd5-0006ux-KZ; Sun, 25 Apr 2021 00:44:24 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= on Sat, 24 Apr 2021 19:02:07 +0200) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> Message-Id: Date: Sun, 25 Apr 2021 00:44:23 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > And so we do! All we do here is to fill a few gaps in the system, > but if you don't feel the need for it then you can just ignore > that the new construct exist. Hold your horses! That is not the way to look at a adding complexity to a basic Lisp construct. Every additional feature added to a fundamental construct increases the complexity of the Lisp language. That always has various kinds of cost whether it is used or not. Since this added feature would rarely be of use, it would have cost and no benefit. Please do not add this feature. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 25 03:35:43 2021 Received: (at 47677) by debbugs.gnu.org; 25 Apr 2021 07:35:43 +0000 Received: from localhost ([127.0.0.1]:41912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laZIs-0008QM-QU for submit@debbugs.gnu.org; Sun, 25 Apr 2021 03:35:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laZIq-0008Q8-Py for 47677@debbugs.gnu.org; Sun, 25 Apr 2021 03:35:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33810) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laZIk-00023Y-LV; Sun, 25 Apr 2021 03:35:34 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4954 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1laZId-0005bK-OU; Sun, 25 Apr 2021 03:35:28 -0400 Date: Sun, 25 Apr 2021 10:35:07 +0300 Message-Id: <83zgxmlsus.fsf@gnu.org> From: Eli Zaretskii To: rms@gnu.org In-Reply-To: (message from Richard Stallman on Sun, 25 Apr 2021 00:44:23 -0400) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: mattiase@acm.org, larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Richard Stallman > Date: Sun, 25 Apr 2021 00:44:23 -0400 > Cc: larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, > 47677@debbugs.gnu.org > > Hold your horses! That is not the way to look at a adding complexity > to a basic Lisp construct. > > Every additional feature added to a fundamental construct increases > the complexity of the Lisp language. That always has various kinds of > cost whether it is used or not. Since this added feature would rarely > be of use, it would have cost and no benefit. FTR: I agree with you. However, sadly this seems to be a minority opinion in the current Emacs development: features are added to Emacs Lisp left, right and center without any serious consideration of the of the costs and benefits balance. The pressure to add features to Emacs Lisp is enormous. It sometimes seems to me that some people regard developing and extending Emacs Lisp to be the most important aspects of the Emacs development. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 25 12:45:46 2021 Received: (at 47677) by debbugs.gnu.org; 25 Apr 2021 16:45:47 +0000 Received: from localhost ([127.0.0.1]:43610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lahtC-0007aT-Lw for submit@debbugs.gnu.org; Sun, 25 Apr 2021 12:45:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:36784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lahtB-0007aH-NN for 47677@debbugs.gnu.org; Sun, 25 Apr 2021 12:45:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Ntk5PHW32LLI+YG+JytdYCjpRonMWU1B11iOmZZgces=; b=H5UjDrXkMdbAkgyIe9Y15Z4ny8 Fgn+yBJEkiWddxdn0JxoojF4IKrX6vqRTUO6ENyXUL0rOVOdn8e/34BkEXOvB/ppCGDymSQsgDQee df+wW43WuYGAE3Fz6GvQQI4e7XiWyBZEiqwweDQJvEFmUgZTXhWcAWDzWXPaHPL7mxGY=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lahsy-00005O-I7; Sun, 25 Apr 2021 18:45:38 +0200 From: Lars Ingebrigtsen To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAKlBMVEUGDREtIhotGBEw LTF1a2qCdm9VTElpXVRDPkCakJSHf4ZIMCCYiXz////g6gyvAAAAAWJLR0QN9rRh9QAAAAd0SU1F B+UEGRApG4DJazMAAAChSURBVDjLY2AgGQjhklAg3axRQD1g4pqWll7iEoEhkeLGYMCYOXM6hkSL AEOVi0U5psRWBobIWRltWCWqMtzSsEoYM2Y0u2ORYC5gNDYox5DYo+6WbGxs6IIhoZYGBsXE+VpI CQQUlRQFBYFMRUEBqDjTJiUUoL0BJrGBCSygoKQE0qvAvQGXDgHiXIAHMAkoYJdQwiUxXABjAy4J A4rMBQBojSPfqYhURgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0wNC0yNVQxNjo0MToyNyswMDow MLnKXeUAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMDQtMjVUMTY6NDE6MjcrMDA6MDDIl+VZAAAA AElFTkSuQmCC X-Now-Playing: Spirit's _1983-1991 (4): Original Versions_: "Nature's Way" Date: Sun, 25 Apr 2021 18:45:31 +0200 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Thu, 22 Apr 2021 15:58:10 +0200") Message-ID: <87wnsql3dg.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Mattias EngdegÄrd writes: > (condition-case x > (throw 'meep 2) > ((:catch 'meep) (+ x 3))) > => 5 > > Multiple catch and error handlers can be mixed freely in the same > `condition-case` form, which can also include a :succes [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: Stefan Kangas , Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd writes: > (condition-case x > (throw 'meep 2) > ((:catch 'meep) (+ x 3))) > =3D> 5 > > Multiple catch and error handlers can be mixed freely in the same > `condition-case` form, which can also include a :success clause. Sorry; I'm not very enthusiastic about this construct -- it just seems like an awkward hack to me. condition-case is about handling errors -- it can be used as a general flow control system, but that's an awkward fit. It conveys intention. So I don't think we should extend it to handle more throw/catch-like things. However, I do agree that Emacs Lisp could need some beefing up in the "early return" department (which this is a kind of example of), but I don't know what that would look like. But I don't think it should look like this. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 25 14:21:56 2021 Received: (at 47677) by debbugs.gnu.org; 25 Apr 2021 18:21:56 +0000 Received: from localhost ([127.0.0.1]:43743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lajOG-0003e5-L7 for submit@debbugs.gnu.org; Sun, 25 Apr 2021 14:21:56 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:45178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lajOE-0003dt-NX for 47677@debbugs.gnu.org; Sun, 25 Apr 2021 14:21:55 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13PILOuq130305; Sun, 25 Apr 2021 18:21:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=5qTFnPjAsCVOo6Xof0W0QqYlq2o82p7GniSW8/5FoA4=; b=BJQwYQtxXa/0tmWgcGy42NpKxkDAioa+D16XyevMcgE+D72VR1gjR80ajPY4MugBqC+J 1N9r7pjxoX9/khn257Lra3aSrZ39Hu34vkLlMYZNGOYefeFL1/1f1UWYuUG8VaOD/RMl W87xoJSA2REbDgdhuF4G0uoimj5Y9Rf7OxOUpUa5dkqH1QLGZQynJEp8xS0CjErMO3Yy BZrJj3Enj3+UkAKD1zNDtWg/I8A9XXGn4w/9ZZ9oPXxSJc46CVUe8Fz7Ci9w5Lv9jC8S fOI10Rf/Nhpkr4/Ek//Cr3HRQuiAyJSEyb7L1RlLPqDG5LzYT0l/ww/VjPg+XjJ4tLnq Eg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 385ahbg5b3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 25 Apr 2021 18:21:47 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13PIGFEQ101746; Sun, 25 Apr 2021 18:21:47 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by userp3020.oracle.com with ESMTP id 384w3qm9t4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 25 Apr 2021 18:21:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uo+ksXX/fjY4jDuc13zbrEWxTuTbJTwu/oB492wgQzvT7x46GexkgYz8w3xiIPbZWJfwQRYQ2gHy8t5w486BKH+aGKYuq3rRbVGlGRzNgQNYU7yDekAi5TMhYnGXPr2JLYZj5Oan9gaQ5icaYRaEBoXZNMWjH85xDuoeEWW/48ETd0UGzA1HEFc/KPd5yWEQq6DMxbQkSj8mZ6T7ZFanMIDqIYPwjXPC1eS8vhcaZcV0egqw/I2f6xp6h9ZR5X4N6WquK1Izp2ZtOBuIruVZfB9y6zB0+inkag3hEzqYLow/p2Xf+6dA1BYDpuwLW0lgSsxwiAGuw4j5hnjInzDgfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5qTFnPjAsCVOo6Xof0W0QqYlq2o82p7GniSW8/5FoA4=; b=KRD6aUvpspk3OAWwbx7uSUHSAaAvp78qPYpu286xUqowUPmVixP4ioXLuFh/Ox6OErd+oG/zHGAM6nfvPXjo2PkF1jYvKLYXK82V8kbIUtywzfOBQr2tCvXzQzsHA6L3dfmDTe/ERAmV7ou+4F+xlQtspwGGTRA/0SGFpNbv+4BpgMF8sLSgAGf7vGYCpaB5OHBk/60IfylxJd9p5qRGDNs8Pmad7nqqOY70P/yg/O+O6qaY0ovspdVCrWFzNoCcsuQK2pmBOIsEJl/Q5gvLbBWN+zwTNCG8UErdQhzZsukS8IMrjrS960IyGXJrk+h2aYVnDONcR1HtrZuR7fritg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5qTFnPjAsCVOo6Xof0W0QqYlq2o82p7GniSW8/5FoA4=; b=yrhuU4HHL+uSYfzHYVp6of7KCKVApZ8WK6FVWuX5aHpYvEYJNx9VYkTHKOCT4wO6SEYuFBBjuSJfZa7HGnXVCQ15IX45NaTh8TnmJ8B9lkz91cTDJaMAEp3iKroeMAcv3oMu04DI6r/LOMcc9qeH/tbOPXtd7UnPgubpERe16Gw= Received: from SA2PR10MB4474.namprd10.prod.outlook.com (2603:10b6:806:11b::15) by SA2PR10MB4780.namprd10.prod.outlook.com (2603:10b6:806:118::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Sun, 25 Apr 2021 18:21:45 +0000 Received: from SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::2109:9725:fd4a:6494]) by SA2PR10MB4474.namprd10.prod.outlook.com ([fe80::2109:9725:fd4a:6494%6]) with mapi id 15.20.4065.021; Sun, 25 Apr 2021 18:21:45 +0000 From: Drew Adams To: Eli Zaretskii , "rms@gnu.org" Subject: RE: [External] : bug#47677: [PATCH] condition-case success continuation Thread-Topic: [External] : bug#47677: [PATCH] condition-case success continuation Thread-Index: AQHXOaWprypV0VaQuECNagHdAavlEarFiQTA Date: Sun, 25 Apr 2021 18:21:45 +0000 Message-ID: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <83zgxmlsus.fsf@gnu.org> In-Reply-To: <83zgxmlsus.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=oracle.com; x-originating-ip: [73.170.83.28] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d45404cf-0f03-4fd4-e377-08d90816fb8c x-ms-traffictypediagnostic: SA2PR10MB4780: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rTdPx6KTexfih+EqVZs7EEaM/HggfPeWuydDcDrhvGrs7XYXjqej0qXd9sX42IvHcKdqoxv0kKyXYQuUDHOCMtgYhlDy7V0oEn4f10BsHaIXBRGMaXTIFMZYsXvalEVnyX4QsA/8n7lQb9VoB4Gzb7mHul2NN1RvXzp0cdc6LCfF2Ci0nHxp5cLpX9xEZJQ7N815cftsXFh1dDL5ApoCJ7KaG7ljEUBQiMfI6/aKCRMpIfXvBMsOgRH+R6uJXdJtQAU+UR6YxLRpsw89qkL8RLiWwpv/icDNRWdiA768nJB13FCP/MxHTsF7uPVrds9fjoE9/a1HtZStPf7xytgCJdw6OQ8mEcLDbgNKQ7X23RVrkgrKnusYbbkexV1LtTA9nY8rID2Yryp1SaVmB3ZCU2mbAcZXgoONHdsh4isr5Nx8UAMGDxSJ0aTtSqkaey97TBy+ENphnxgqo/2G5looyGdsHdMHzBOcy+tVPvyob/fHnVkaCECEh0fEeJ8HyqhBC4G3Xle0TGtye99tl7yeI1EeoxM5ZIlvVLyrDzznPX1WvZc5XR4itgpj73sN+giNn6BAQD6M2KET7RP45C+n00vT5eFPlLeNFD/BrAoWAPw= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4474.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(376002)(396003)(366004)(346002)(66476007)(8936002)(66446008)(66556008)(6506007)(2906002)(64756008)(7696005)(66946007)(76116006)(44832011)(52536014)(4326008)(8676002)(54906003)(4744005)(316002)(5660300002)(71200400001)(33656002)(110136005)(478600001)(38100700002)(26005)(122000001)(9686003)(86362001)(186003)(55016002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Knta/sSwZsxkVzmbDyAq4Posngjlztjyjmo/+lssGS7qLmBOLiCOo1Nf2lwA?= =?us-ascii?Q?gCf04MYDC/L0KOt/Ht/+JKA2tbGKWdSdXTLcUDelMJJ2pqPXls3uUx0Xif12?= =?us-ascii?Q?saPruanJhRuRJlVhVXp+LNnfZlVMVA/nXQhuvPNt92y7IVYEZI+wwOZkf3V6?= =?us-ascii?Q?2SD65kbRN2+NbIjymIhrmWa4vkF7oLintL03IQ30iFMa8/1mec4de1d7SNts?= =?us-ascii?Q?LLksFc9wGrZnE1gMBP2a5e3yFBvdln2HrmvN0uLXzaLMgc48KOyRu21Gygp7?= =?us-ascii?Q?8LPCQHKf55hdSma4dYUnuSbGY8y4r60x9YlDYYY0b/fRe5BlYVWwe1aAcJtv?= =?us-ascii?Q?RQ+B4yVMIdNOGz0JUW5oDqmnhdFFTGcFTczKLL1chEUL4waqTDFBIt8B8RqV?= =?us-ascii?Q?nduMZO/d39WAmnH5PfBqVw+k8lAqDC6mN4rSztFF0H65YAIQ1JKyCbHWOr6f?= =?us-ascii?Q?DNUK6L9A75jz9h/8FQ4WlXtl4tg1mDLxw6Sj+K0QHgvHYxF8Tm+eI0fPJDIA?= =?us-ascii?Q?yIFx/SShQ9g3MFG+0lOoyYtbCx41qs2rJrYVbcqfRGCPqxpJ44FJutkKfb1q?= =?us-ascii?Q?uLZJnfAxN+GMoJHexWO4/lSlP/iX+ItzVMNlw3bUV6QHe6B3mWne/aULmeXW?= =?us-ascii?Q?Nan/9HpZmzfPjPQciEqHKvH4tuNB8hMFVgVXZ7oLTbiRixPo8KY9DbkMJ5ka?= =?us-ascii?Q?NSBMAYcLIg3vdAkVzEQgTKhINtyBE4UDkAmm13Eb6JYKq397AxfQwar42Dik?= =?us-ascii?Q?nsrx3CdOE722S99g9exSXL63DweGRUbw0zbtyLiSJMfE/zmo8pS7USm20pyQ?= =?us-ascii?Q?Q6wc1TFqa9pQ1YAX6n9I5L0MsTMZHTXVZ4wlE+KX/rn+Zdrqq2y1fzkJ+y96?= =?us-ascii?Q?i16pWgf6nqTtchc1WENIXH/773q5DpWpRML1/yr+81A29UY+3D66lt8EUzOJ?= =?us-ascii?Q?eZqUd5a6SQIPx2pT+bGvdI9FE+k9ngZSlkvVtTA8o1qWaomDoe9b4aThMwzq?= =?us-ascii?Q?k2JYehxxXdOZPIP1NQ8qMbB7odeTPWOGMrQAH0LPcz8GFOmkxsc+M3HA5Abz?= =?us-ascii?Q?1sZkjbXN7PKvBJ4/4sIGIJC2w8CSkdtaD4fDFrVq5NOZd82MeS1Kx8SenyBl?= =?us-ascii?Q?XrBc5TvtOERiXcDsQaXSmhZuTmFfkQhmchf9gKXqt1PuH7L65G7noKYC58jR?= =?us-ascii?Q?n5JyEy8YC+cFhv1Z1iBgcc4p8y+RAZBayspkltmpqlhjZWmtH/qvuGwHsViX?= =?us-ascii?Q?GXFP5TvaSDRmPB3sF+sETD5r0owmh4zrd9rO36nepjJUjD8CxY4fbWZ3Qd6S?= =?us-ascii?Q?kWw0XbOSeZyHxUwwN0fBE2SO?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4474.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d45404cf-0f03-4fd4-e377-08d90816fb8c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2021 18:21:45.1556 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TtSaiZc2sMu4xJf9CwczDkNqgKkvxA+ah0E9b8emTIr8Mjp4tvxvFQhFOqzViDVzwsNdKIPPA+GF/0yI7Ph6ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4780 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9965 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104250139 X-Proofpoint-GUID: YqEbbWPlsEaIpGJ9vSGyEkk-iKTPP2Gb X-Proofpoint-ORIG-GUID: YqEbbWPlsEaIpGJ9vSGyEkk-iKTPP2Gb X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9965 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1011 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104250139 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 47677 Cc: "mattiase@acm.org" , "larsi@gnus.org" , "stefan@marxist.se" , "monnier@iro.umontreal.ca" , "47677@debbugs.gnu.org" <47677@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) > > Hold your horses! That is not the way to look at a adding complexity > > to a basic Lisp construct. > > > > Every additional feature added to a fundamental construct increases > > the complexity of the Lisp language. That always has various kinds > > of cost whether it is used or not. Since this added feature would > > rarely be of use, it would have cost and no benefit. >=20 > FTR: I agree with you. +1. > However, sadly this seems to be a minority > opinion in the current Emacs development: features are added to Emacs > Lisp left, right and center without any serious consideration of the > of the costs and benefits balance. The pressure to add features to > Emacs Lisp is enormous. It sometimes seems to me that some people > regard developing and extending Emacs Lisp to be the most important > aspects of the Emacs development. Sad, yes. FWIW, I'm in awe of the energy and patience you devote to Emacs development, and I hope you don't burn out. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 25 14:25:09 2021 Received: (at 47677) by debbugs.gnu.org; 25 Apr 2021 18:25:09 +0000 Received: from localhost ([127.0.0.1]:43748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lajRN-0003jI-4F for submit@debbugs.gnu.org; Sun, 25 Apr 2021 14:25:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lajRL-0003j2-42 for 47677@debbugs.gnu.org; Sun, 25 Apr 2021 14:25:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:40957) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lajRD-0003yA-9p; Sun, 25 Apr 2021 14:25:00 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2466 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lajQx-0006aP-9l; Sun, 25 Apr 2021 14:24:50 -0400 Date: Sun, 25 Apr 2021 21:24:23 +0300 Message-Id: <838s56kyso.fsf@gnu.org> From: Eli Zaretskii To: Drew Adams In-Reply-To: (message from Drew Adams on Sun, 25 Apr 2021 18:21:45 +0000) Subject: Re: [External] : bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <83zgxmlsus.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: rms@gnu.org, mattiase@acm.org, stefan@marxist.se, 47677@debbugs.gnu.org, monnier@iro.umontreal.ca, larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Drew Adams > CC: "mattiase@acm.org" , "larsi@gnus.org" , > "stefan@marxist.se" , > "monnier@iro.umontreal.ca" > , > "47677@debbugs.gnu.org" <47677@debbugs.gnu.org> > Date: Sun, 25 Apr 2021 18:21:45 +0000 > > Sad, yes. FWIW, I'm in awe of the energy and patience you > devote to Emacs development, and I hope you don't burn out. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 00:40:20 2021 Received: (at 47677) by debbugs.gnu.org; 26 Apr 2021 04:40:20 +0000 Received: from localhost ([127.0.0.1]:44149 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lat2i-0003bd-8x for submit@debbugs.gnu.org; Mon, 26 Apr 2021 00:40:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lat2f-0003bL-Oh for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 00:40:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48299) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lat2Y-0000P9-M7; Mon, 26 Apr 2021 00:40:11 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lat2P-0007WQ-6i; Mon, 26 Apr 2021 00:40:01 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Eli Zaretskii In-Reply-To: <83zgxmlsus.fsf@gnu.org> (message from Eli Zaretskii on Sun, 25 Apr 2021 10:35:07 +0300) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <83zgxmlsus.fsf@gnu.org> Message-Id: Date: Mon, 26 Apr 2021 00:40:01 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: mattiase@acm.org, larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > FTR: I agree with you. However, sadly this seems to be a minority > opinion in the current Emacs development: features are added to Emacs > Lisp left, right and center without any serious consideration of the > of the costs and benefits balance. The pressure to add features to > Emacs Lisp is enormous. The reason GNU packages have maintainers is so that they can make the design decisions. We can stand against pressure. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 07:53:41 2021 Received: (at 47677) by debbugs.gnu.org; 26 Apr 2021 11:53:41 +0000 Received: from localhost ([127.0.0.1]:44786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lazo5-00009T-AQ for submit@debbugs.gnu.org; Mon, 26 Apr 2021 07:53:41 -0400 Received: from mail1480c50.megamailservers.eu ([91.136.14.80]:59460 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lazo0-00009B-Dd for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 07:53:40 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1619438009; bh=7KxKiEe5f5xZJXjrtzCFuhgIs2WryH/ZEz+9cialPuk=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=SgdcWEUek/tKqM5t/Q7kkZ1d+MJJsRQm+2ywpxfJj5G+j8so6fWxtD2pUZo+DHr3/ fyBuiemck8WtK5CDQustRQi+EUl5aqfMcF/3T+6SSj+DN69qpNCuiv1EyC+aX2FUyX LvItK6AOKyEQr1w5dA2JkvNDRRft0RLRCfoN9G9U= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13QBrR7b024808; Mon, 26 Apr 2021 11:53:28 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <87wnsql3dg.fsf@gnus.org> Date: Mon, 26 Apr 2021 13:53:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <0CE64301-EF9E-4351-8CFC-6DD272B2B230@acm.org> References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <87wnsql3dg.fsf@gnus.org> To: Lars Ingebrigtsen X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1F.6086A9B9.0047, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=J9HUEzvS c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=EA0qI9qQgp634nb7qikA:9 a=CjuIK1q_8ugA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 25 apr. 2021 kl. 18.45 skrev Lars Ingebrigtsen : > condition-case is about handling errors -- it can be used as a general > flow control system, but that's an awkward fit. It conveys intention. > So I don't think we should extend it to handle more t [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 47677 Cc: Stefan Kangas , Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 25 apr. 2021 kl. 18.45 skrev Lars Ingebrigtsen : > condition-case is about handling errors -- it can be used as a general > flow control system, but that's an awkward fit. It conveys intention. > So I don't think we should extend it to handle more throw/catch-like > things. Most other languages use the same exception system for both errors and = 'throws'; the distinction in Lisp is an artefact of history. Both are = dynamically-scoped single-shot upwards-only value-conveying non-local = control transfers (or described in continuation terms with about as many = adjectives). The differences are minor. Several times I've had to hack around the inability of `catch` to = distinguish throws from normal termination and could go on doing so, but = it feels like making function calls by manual variable assignment, stack = operations and jumps. The byte code has no trouble expressing a more = useful catch; it's just an arbitrary restriction in our Lisp primitives. In addition, `catch` and `condition-case` don't compose. It would be = interesting to design primitives that do but since that seems tricky = (prove me wrong!), a unified `condition-case` does the job with a = minimum of fuss and is definitely not a hack. > However, I do agree that Emacs Lisp could need some beefing up in the > "early return" department Yes! But catch/throw is good for getting out of deep function call = chains which is not quite the same thing. They are hard to optimise well = for local use (exiting a loop or function) because it is difficult to = prove the absence of throws elsewhere. A variant of block/return-from would do, but better optimisations for = local functions (TCO in particular) may be at least as useful. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 08:45:20 2021 Received: (at 47677) by debbugs.gnu.org; 26 Apr 2021 12:45:21 +0000 Received: from localhost ([127.0.0.1]:44867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb0bz-0001Rx-So for submit@debbugs.gnu.org; Mon, 26 Apr 2021 08:45:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb0bw-0001Rf-H3 for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 08:45:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55402) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lb0bp-0006wG-5h; Mon, 26 Apr 2021 08:45:06 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2104 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lb0bg-0006kX-3K; Mon, 26 Apr 2021 08:44:56 -0400 Date: Mon, 26 Apr 2021 15:44:37 +0300 Message-Id: <83im49jjuy.fsf@gnu.org> From: Eli Zaretskii To: rms@gnu.org In-Reply-To: (message from Richard Stallman on Mon, 26 Apr 2021 00:40:01 -0400) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <83zgxmlsus.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: mattiase@acm.org, larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Richard Stallman > Cc: mattiase@acm.org, larsi@gnus.org, stefan@marxist.se, > monnier@iro.umontreal.ca, 47677@debbugs.gnu.org > Date: Mon, 26 Apr 2021 00:40:01 -0400 > > > FTR: I agree with you. However, sadly this seems to be a minority > > opinion in the current Emacs development: features are added to Emacs > > Lisp left, right and center without any serious consideration of the > > of the costs and benefits balance. The pressure to add features to > > Emacs Lisp is enormous. > > The reason GNU packages have maintainers is so that they can make > the design decisions. We can stand against pressure. IME, that only works up to a point. When pressure becomes high enough and from many contributors, standing fast against it has significant negative effects: some people become frustrated and we risk losing them, the general atmosphere becomes unpleasant, and if nothing else, a lot of the maintainers' time is wasted on the dispute. And this is assuming all the maintainers agree, which is not always the case. The only practical way to prevent such developments IME is to convince people that they are wrong. And that is not easy when the subject is not exactly the maintainer's domain of expertise. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 11:12:15 2021 Received: (at 47677) by debbugs.gnu.org; 26 Apr 2021 15:12:15 +0000 Received: from localhost ([127.0.0.1]:46778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb2uF-0005dx-CQ for submit@debbugs.gnu.org; Mon, 26 Apr 2021 11:12:15 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34659) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb2uC-0005dh-T3 for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 11:12:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 881C85C0135; Mon, 26 Apr 2021 11:12:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 26 Apr 2021 11:12:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=eXlcLHk5HcLPaATNMVyJWkzn9c EHWX3L0lVSjZ+ZRnE=; b=wKwvYI8AHoIwORWmtWGXjP/Dt40orPLkL3JK5VlTSB MY3ymcw6BFTOcChvz/jreZMivoScI0JQKWkjhTraVLElHky1YbAxnUltJS8NMy4h LJLdds8padXfNgmA8v7XrKa6Chgf0KM2dZQDb+daHhFr0GZQobBpXvL26J9PX07Y t0fxUEdJ9GD8c5Ywl6kqinYl1cI0UKT0fFS2gCVv/ehLJDS83ImA539ShfCAOJHx j3V/7HEsNlRy8v73kuQ2uS6vuG90NIe7YXsczJXnu9T6jkFZcOY8a+fwi4vyuGUX nBWup/On8kaIvJgiUA1jdoTUizymVhZp69drbxswp9wA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=eXlcLH k5HcLPaATNMVyJWkzn9cEHWX3L0lVSjZ+ZRnE=; b=A7ns3QpleieoUnlTJbG/ba UJf5yzWE1foHHlW5OHphcwH+/W7Pxz3JLtqNqn0UvhkNdu6tQKqfQ9n3pGvPzerz 2Lakmz6kCypZbcca8eHQxuh/Odg5iyez2toXjBN4Ul7o83ybWuroL84ShCrtP4ZN tiTCbLlyLDqFCIH9u0XlimUd8NamCu5h9ZS82UdtX+aLuUrrEl90LsyRPa+G/3G0 +EwWs/6haGq32SaT/p50FfFOqBmzyu1DIj+5kS8JcEFk6ORoOa6tLnu6SZIzp1Nz VXKsSOObHlGJIlFjnsucJ4WEkIkTNPVPV3snP7jLM4Kd9QjlL3bg8Q0d4lS/s93A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddukedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepvdevkeffvdeuvefhuddtjeehkedvueefveettddtveduudfgieffieev ieevhfdtnecukfhppeekgedrvddtgedrudelfedruddtieenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfghhunhgsihhnsehfrghsthhmrghi lhdrfhhm X-ME-Proxy: Received: from fgunbin.local (unknown [84.204.193.106]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Apr 2021 11:12:05 -0400 (EDT) From: Filipp Gunbin To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Sat, 24 Apr 2021 19:02:07 +0200") References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Date: Mon, 26 Apr 2021 18:12:00 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, stefan@marxist.se, Richard Stallman , 47677@debbugs.gnu.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Please, let's not add such features to the basic Emacs Lisp constructs. It's great to see Emacs Lisp being simple. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 17:57:51 2021 Received: (at 47677) by debbugs.gnu.org; 26 Apr 2021 21:57:51 +0000 Received: from localhost ([127.0.0.1]:47434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb9El-0007bw-3S for submit@debbugs.gnu.org; Mon, 26 Apr 2021 17:57:51 -0400 Received: from heytings.org ([95.142.160.155]:54474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lb9Ei-0007bl-6h for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 17:57:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1619474266; bh=1gvnAzWemSTb579lSHM+iQMPgr/Q4E3srQnMJCLuYOs=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=f6xDaa8+OnuprVFYHcIwtnvxqV6IC8iKLZf4VllG3/HqimUDnstBD5Anh5EHCfoQ/ VwVRqbfytwv5SSHNOOQmZd8+xqACq/JqN4wjzP93sd7gwIOtOFqHpo3kOufqBcLJnE vFFVS67pv4tudOILqkSVsWWZAWsxN3d43VNXlWye0s2ejvcGuj5fgFtRQBnC+KkBuY StUM2x7o5cug3i0mGtCzP3Vv0USL7EoCDl3asc7SmVC0r6R+y+0C6tYikm1v1mALfE WTMfP+mM9a3nj2jKKzvJE6r3Wk6TDGPsr9/d7UhV2I0oCyJQx0NvrWoOznzGX8KZHK FGZZiNSnBP54Q== Date: Mon, 26 Apr 2021 21:57:46 +0000 From: Gregory Heytings To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation In-Reply-To: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> Message-ID: <770e344122f2eed113c2@heytings.org> References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > > This patch adds the condition-case handler syntax > > (:success BODY) > > for code executed when the protected form terminates without error. BODY > is then executed with the variable bound to the result of the protected > form, and the result of BODY is then the value of the condition-case > form as usual. > > This plugs an annoying hole in elisp: there hasn't been any direct > access to the success continuation > Would a macro not be enough to cover that particular programming pattern? E.g. something like: (defmacro success-case (value action continuation &rest handlers) `(catch 'success-case-fail ((lambda (,value) ,continuation) (catch 'success-case-success (throw 'success-case-fail (condition-case ,value (throw 'success-case-success ,action) ,@handlers)))))) With this macro you can write for example: (success-case result (read buffer) (use result) (end-of-file 'eof)) which is IMO even more concise and elegant. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 23:46:44 2021 Received: (at 47677) by debbugs.gnu.org; 27 Apr 2021 03:46:44 +0000 Received: from localhost ([127.0.0.1]:47685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbEgO-0003V3-95 for submit@debbugs.gnu.org; Mon, 26 Apr 2021 23:46:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbEgJ-0003Ul-IP for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 23:46:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43152) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbEgD-0001Dk-SK; Mon, 26 Apr 2021 23:46:33 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lbEgC-000677-1D; Mon, 26 Apr 2021 23:46:32 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Eli Zaretskii In-Reply-To: <83im49jjuy.fsf@gnu.org> (message from Eli Zaretskii on Mon, 26 Apr 2021 15:44:37 +0300) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <83zgxmlsus.fsf@gnu.org> <83im49jjuy.fsf@gnu.org> Message-Id: Date: Mon, 26 Apr 2021 23:46:32 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: mattiase@acm.org, larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] Yes you can stand against pressure to make unwise changes. So can I. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 26 23:47:03 2021 Received: (at 47677) by debbugs.gnu.org; 27 Apr 2021 03:47:03 +0000 Received: from localhost ([127.0.0.1]:47689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbEgh-0003W4-HN for submit@debbugs.gnu.org; Mon, 26 Apr 2021 23:47:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbEgg-0003VR-4E for 47677@debbugs.gnu.org; Mon, 26 Apr 2021 23:47:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43157) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbEga-0001SW-Pa; Mon, 26 Apr 2021 23:46:56 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1lbEgZ-00069Y-TO; Mon, 26 Apr 2021 23:46:56 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= In-Reply-To: <0CE64301-EF9E-4351-8CFC-6DD272B2B230@acm.org> (message from Mattias =?iso-8859-1?Q?Engdeg=C3=A5rd?= on Mon, 26 Apr 2021 13:53:26 +0200) Subject: Re: bug#47677: [PATCH] condition-case success continuation References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> <87wnsql3dg.fsf@gnus.org> <0CE64301-EF9E-4351-8CFC-6DD272B2B230@acm.org> Message-Id: Date: Mon, 26 Apr 2021 23:46:55 -0400 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 47677 Cc: larsi@gnus.org, stefan@marxist.se, monnier@iro.umontreal.ca, 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > Most other languages use the same exception system for both errors > and 'throws'; the distinction in Lisp is an artefact of history. That's fine. We are working with Lisp, not those other languages. The most important thing about catch is to keep it stable. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 27 11:31:48 2021 Received: (at 47677-done) by debbugs.gnu.org; 27 Apr 2021 15:31:48 +0000 Received: from localhost ([127.0.0.1]:50597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbPgh-0005pX-PT for submit@debbugs.gnu.org; Tue, 27 Apr 2021 11:31:48 -0400 Received: from mail1465c50.megamailservers.eu ([91.136.14.65]:38008 helo=mail268c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbPgf-0005pG-1d for 47677-done@debbugs.gnu.org; Tue, 27 Apr 2021 11:31:46 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1619537498; bh=CaUBussdhttE7e/wLREiraojNcBjwlzJte+b44/MtHQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=LRAEOeLmwvc0G0ZcKg/DzM+Xf+wbVLGd2DN+693SbDRicXAsDeXOq8bSTUxfQuwPs 5I2lKOE1nwbinPDWBmoicTR+TG/fStj4YbPyeb3JFx3wbXUxWmjXoEnr0Xw1xh7szl X+St/A0ceu2CoCF4KR4LKIIzgBYSe9Lu7LYfMz4w= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail268c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 13RFVW3P011093; Tue, 27 Apr 2021 15:31:37 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.20\)) Subject: Re: bug#47677: [PATCH] condition-case success continuation From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Tue, 27 Apr 2021 17:31:31 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> To: Filipp Gunbin X-Mailer: Apple Mail (2.3445.104.20) X-CTCH-RefID: str=0001.0A742F20.60882E5A.003A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Pq7tkDE3 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=BqXj_juDVtpP47wdGX8A:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 26 apr. 2021 kl. 17.12 skrev Filipp Gunbin : > Please, let's not add such features to the basic Emacs Lisp constructs. > It's great to see Emacs Lisp being simple. I'd like to clear up some misconceptions here. (Filipp, this does not mean that I think that you wrote something stupid -- quite the contrary.) Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 47677-done Cc: Lars Ingebrigtsen , Stefan Kangas , Stefan Monnier , 47677-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 26 apr. 2021 kl. 17.12 skrev Filipp Gunbin : > Please, let's not add such features to the basic Emacs Lisp = constructs. > It's great to see Emacs Lisp being simple. I'd like to clear up some misconceptions here. (Filipp, this does not = mean that I think that you wrote something stupid -- quite the = contrary.)=20 First, is Emacs Lisp really simple? Yes and no. It's not easy to tell = where its boundaries are, especially since it doesn't have a proper = module or namespace system or a well-defined 'core language'. Basic = semantics -- control structures, built-in types, primitives and so on -- = are not too messy but definitely more than they need to be; Scheme it is = not. No wonder given its age; it has held up remarkably well = considering, but it would be even more remarkable if modern eyes could = not find flaws in it. Second, is simplicity paramount among concerns? Clearly not: = compatibility matters, and so does programming usability. It is also not = clear whether a change makes a language more or less simple; adding = bignums, for example, probably made the language less complex for the = user. Even if (hypothetically) people got by without `unwind-protect` by = catching and re-raising errors, few would object to adding that = construct as a special form because it made the language less simple. Of course you were talking about changes that make the language more = difficult to use, but my point is that it is far from clear what kind of = change actually does that. Unrelated to your comment: since several people have misunderstood the = proposal, I'm closing the bug to avoid conflating issues (I should have = listened to Stefan Kangas); a new one can be reopened for the patch at = hand when and if I get more free time. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 27 15:00:57 2021 Received: (at 47677) by debbugs.gnu.org; 27 Apr 2021 19:00:57 +0000 Received: from localhost ([127.0.0.1]:50925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbSx7-00051n-5G for submit@debbugs.gnu.org; Tue, 27 Apr 2021 15:00:57 -0400 Received: from heytings.org ([95.142.160.155]:55714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbSx5-00051d-43 for 47677@debbugs.gnu.org; Tue, 27 Apr 2021 15:00:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1619550053; bh=R/J4Cy9ayVFAELnlE9a+whKIy0QGhNhImXpfzE/2LW8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=wfrMc+ynuIqJvx7MjMypKGVckSxnTMwnseo/WN1Qt4rKOWiQI/CkrJnfPU8NrrCKk qjZX5ZuxVqkLWvziZ9qsxgm/aDHO2hm8qFIWjQOLGrf2mA4q9Km5tWT0gwij087zvp UE51FvxEKlKPH6wLDAMclAv4WqElMxrzlPpgAor0dtHX+Y/27Ahc8wa+ZeSd0SJ+5c oUyjkhhEgBKxKSe1sNkKP5QEmnzbBmdnDWiz2YGTjrqYyj6MM5pu93D9pVhXcZwRrn 66ofYuSPMj6yH4JMUKELwUfdSMe8PsYkWfDDUoz68SAHQrjOoMVatkktJCERFbg2F8 86mjZXgY+VG9w== Date: Tue, 27 Apr 2021 19:00:53 +0000 From: Gregory Heytings To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation In-Reply-To: Message-ID: References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 47677 Cc: Stefan Kangas , Lars Ingebrigtsen , Filipp Gunbin , Stefan Monnier , 47677@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > > Unrelated to your comment: since several people have misunderstood the > proposal, I'm closing the bug > I guess you did not see my previous post in this bug thread. This bug should not be closed. I agree with Richard and Eli, it is not necessary to add that feature to Elisp, the more so as it can be implemented with a short macro: (defmacro if-success (var action continuation &rest handlers) "Regain control when an error is signaled, otherwise continue. Execute ACTION and, if no error happened, CONTINUATION, with VAR bound to the return value of ACTION. Otherwise, execute the appropriate HANDLER, with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA)." `(catch 'success-case-failure ((lambda (,var) ,continuation) (catch 'success-case-success (throw 'success-case-failure (condition-case ,var (throw 'success-case-success ,action) ,@handlers)))))) From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 29 08:45:40 2021 Received: (at 47677-done) by debbugs.gnu.org; 29 Apr 2021 12:45:40 +0000 Received: from localhost ([127.0.0.1]:55050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc631-0005d2-SO for submit@debbugs.gnu.org; Thu, 29 Apr 2021 08:45:40 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lc62z-0005co-E8 for 47677-done@debbugs.gnu.org; Thu, 29 Apr 2021 08:45:39 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 156235C005E; Thu, 29 Apr 2021 08:45:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 29 Apr 2021 08:45:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= veiDjo+SIDvj+iZRxlSfro9c8vSN4XMwOcUt7m9cDcc=; b=L03hW/nYbS1/k3ih KFL56h4wADyogiSu6Y4A7/kviPg0zsekekvLbI1Fyxe7CvGAKfNXxuFL9peDTLFs lxi6GH23XmUKWhP6tlaGwu+aFGu+NlvUAsFCBy+P1lVV0XgwWHkpaLRFFhcr/Igz Fh5OjdE8dNJeU9vrVJQyr5I/kwiHnAvPSK+s4rtTEZvDg/Kxl7+ZlAPDsZNd4ycw atbdR2+lhqnmu1xdOpheCDGtO8UMIzXEvE/2dY5wjaQiE9FfsbCS/H2wvv42CiZj 7DVHUQo74/r5GlrORyVtU9HX7juAnH5oMf26aJsonN1Im0sz/dpuoSINN2+Og2kW 7194xQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=veiDjo+SIDvj+iZRxlSfro9c8vSN4XMwOcUt7m9cD cc=; b=WMV52VRzeHRG2X1VLFrN9Ezac+RluDSZZheT63T2ZjYzCdUYPViwnKTR0 80plxsp4GW+Hpn9bY57D1zb3FozzdzeBS0c4KII3n7vh7k6b+MovNkXEfe5BvRPk HrYFWHy9j2tb+BAqzihAnETQvXFJ7cBjE4O6LJoWDVU4jxz3SLvp9Edb1P2FmBLQ nSzhYdCUV4jaXaws9Y+FHOCUQKTdr/xVcOeOjDpM9nTu4yO16gPiVVVMy5NG00Ok 3MzncrPPtk2rkD0RtJDpd9KsfAc2fGVyRvNu4d4xn9MWgq3Wd56XHjxLLCI0EFEA IfQDwG+8XFLMr5nh2r7a0dVkNDtwQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddvgedgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtgfesthhqredttderjeenucfhrhhomhephfhilhhi phhpucfiuhhnsghinhcuoehfghhunhgsihhnsehfrghsthhmrghilhdrfhhmqeenucggtf frrghtthgvrhhnpeekvdekudelvddtvdelveejgeetudfgvdelgfeftefgkeejheehvefh gfetffeigfenucfkphepkeegrddvtdegrdduleefrddutdeinecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfhhguhhnsghinhesfhgrshhtmhgr ihhlrdhfmh X-ME-Proxy: Received: from fgunbin.local (unknown [84.204.193.106]) by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Apr 2021 08:45:30 -0400 (EDT) From: Filipp Gunbin To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Subject: Re: bug#47677: [PATCH] condition-case success continuation In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Tue, 27 Apr 2021 17:31:31 +0200") References: <219007D9-0FD0-4AC2-A8B0-24A0FC277AE8@acm.org> <87lf9nzy48.fsf@gnus.org> <87F315E7-7F8A-46C5-A71B-F090F067D0B8@acm.org> <87sg3uskgt.fsf@gnus.org> <87zgy1qkni.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Date: Thu, 29 Apr 2021 15:45:28 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 47677-done Cc: Lars Ingebrigtsen , Stefan Kangas , Stefan Monnier , 47677-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Mattias, On 27/04/2021 17:31 +0200, Mattias Engdeg=C3=A5rd wrote: > 26 apr. 2021 kl. 17.12 skrev Filipp Gunbin : > >> Please, let's not add such features to the basic Emacs Lisp constructs. >> It's great to see Emacs Lisp being simple. > > I'd like to clear up some misconceptions here. (Filipp, this does not > mean that I think that you wrote something stupid -- quite the > contrary.) > > First, is Emacs Lisp really simple? Yes and no. It's not easy to tell > where its boundaries are, especially since it doesn't have a proper > module or namespace system or a well-defined 'core language'. Basic > semantics -- control structures, built-in types, primitives and so on > -- are not too messy but definitely more than they need to be; Scheme > it is not. No wonder given its age; it has held up remarkably well > considering, but it would be even more remarkable if modern eyes could > not find flaws in it. > > Second, is simplicity paramount among concerns? Clearly not: > compatibility matters, and so does programming usability. It is also > not clear whether a change makes a language more or less simple; > adding bignums, for example, probably made the language less complex > for the user. Even if (hypothetically) people got by without > `unwind-protect` by catching and re-raising errors, few would object > to adding that construct as a special form because it made the > language less simple. > > Of course you were talking about changes that make the language more > difficult to use, but my point is that it is far from clear what kind > of change actually does that. Yes, there're no objective criteria for simplicity. I should have stated more clearly what I meant. I just like that Elisp is not overloaded with functionality and syntactic sugar. The docstrings of many constructs (catch in particular) are short and clear. That allows (relatively) easy entry for non-lispers (I remember myself 8 years or so ago). For more complex things, if a macro way is possible, I think it should be preferred. Filipp From unknown Sun Jun 15 08:24:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 28 May 2021 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator