* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) [not found] ` <20180904230315.6EB44209DC@vcs0.savannah.gnu.org> @ 2018-09-05 2:46 ` Stefan Monnier 2018-09-05 14:38 ` Noam Postavsky 0 siblings, 1 reply; 14+ messages in thread From: Stefan Monnier @ 2018-09-05 2:46 UTC (permalink / raw) To: emacs-devel; +Cc: Noam Postavsky > +A CONDITION-NAME of t applies to any error symbol. All error symbols are caught by `error` already. Those extra conditions caught by `t` are non-error conditions (the only one I know of is `quit`, BTW). Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-05 2:46 ` [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) Stefan Monnier @ 2018-09-05 14:38 ` Noam Postavsky 2018-09-05 15:31 ` Stefan Monnier 2018-09-05 15:31 ` Stefan Monnier 0 siblings, 2 replies; 14+ messages in thread From: Noam Postavsky @ 2018-09-05 14:38 UTC (permalink / raw) To: Stefan Monnier; +Cc: Emacs developers On 4 September 2018 at 22:46, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >> +A CONDITION-NAME of t applies to any error symbol. > > All error symbols are caught by `error` already. Those extra conditions > caught by `t` are non-error conditions Hmm, right. The rest of the docstring talks only about errors though. Should we change the whole thing? While technically more accurate, saying "Regain control when a signal is signaled" sounds a bit funny. Otherwise, fixing just that sentence: A handler is applicable to an error if CONDITION-NAME is one of the -error's condition names. A CONDITION-NAME of t applies to any error -symbol. If an error happens, the first applicable handler is run. +error's condition names. A CONDITION-NAME of t applies to any condition +name. If an error happens, the first applicable handler is run. > (the only one I know of is `quit`, BTW). That, and possible silly code which does something like: (signal 'not-an-error-symbol "oops") ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-05 14:38 ` Noam Postavsky @ 2018-09-05 15:31 ` Stefan Monnier 2018-09-07 1:01 ` Noam Postavsky 2018-09-05 15:31 ` Stefan Monnier 1 sibling, 1 reply; 14+ messages in thread From: Stefan Monnier @ 2018-09-05 15:31 UTC (permalink / raw) To: Noam Postavsky; +Cc: Emacs developers > Hmm, right. The rest of the docstring talks only about errors though. > Should we change the whole thing? While technically more accurate, > saying "Regain control when a signal is signaled" sounds a bit funny. I think the solution normally used is that "signal" is only used for the action, while the event-object is called "condition". I.e. "Regain control when a condition is signaled". Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-05 15:31 ` Stefan Monnier @ 2018-09-07 1:01 ` Noam Postavsky 2018-09-07 1:08 ` Stefan Monnier ` (3 more replies) 0 siblings, 4 replies; 14+ messages in thread From: Noam Postavsky @ 2018-09-07 1:01 UTC (permalink / raw) To: Stefan Monnier; +Cc: Emacs developers On 5 September 2018 at 11:31, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >> Hmm, right. The rest of the docstring talks only about errors though. >> Should we change the whole thing? While technically more accurate, >> saying "Regain control when a signal is signaled" sounds a bit funny. > > I think the solution normally used is that "signal" is only used for the > action, while the event-object is called "condition". I.e. > "Regain control when a condition is signaled". So how about this: DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, - doc: /* Regain control when an error is signaled. -Executes BODYFORM and returns its value if no error happens. + doc: /* Regain control when a condition is signaled. +Executes BODYFORM and returns its value if nothing is signaled. Each element of HANDLERS looks like (CONDITION-NAME BODY...) where the BODY is made of Lisp expressions. -A handler is applicable to an error if CONDITION-NAME is one of the -error's condition names. A CONDITION-NAME of t applies to any error -symbol. If an error happens, the first applicable handler is run. +A handler is applicable to a condition if CONDITION-NAME is one of the +condition's names. A CONDITION-NAME of t applies to any condition +name. If a condition is signaled, the first applicable handler is run. The car of a handler may be a list of condition names [...] -When a handler handles an error, control returns to the `condition-case' +When a handler handles a condition, control returns to the `condition-case' and it executes the handler's BODY... with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 1:01 ` Noam Postavsky @ 2018-09-07 1:08 ` Stefan Monnier 2018-09-07 1:10 ` Davis Herring ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Stefan Monnier @ 2018-09-07 1:08 UTC (permalink / raw) To: Noam Postavsky; +Cc: Emacs developers >> I think the solution normally used is that "signal" is only used for the >> action, while the event-object is called "condition". I.e. >> "Regain control when a condition is signaled". > > So how about this: Looks good to me, Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 1:01 ` Noam Postavsky 2018-09-07 1:08 ` Stefan Monnier @ 2018-09-07 1:10 ` Davis Herring 2018-09-08 2:16 ` Noam Postavsky 2018-09-07 6:51 ` Eli Zaretskii [not found] ` <<83in3hvlyx.fsf@gnu.org> 3 siblings, 1 reply; 14+ messages in thread From: Davis Herring @ 2018-09-07 1:10 UTC (permalink / raw) To: Noam Postavsky; +Cc: Stefan Monnier, Emacs developers > with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. You left one "ERROR" here. Meanwhile, it might be good to leave the word "error" somewhere in the text, just so no one uninitiated reads it and decides it _isn't_ for error handling. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 1:10 ` Davis Herring @ 2018-09-08 2:16 ` Noam Postavsky 2018-09-17 0:40 ` Noam Postavsky 0 siblings, 1 reply; 14+ messages in thread From: Noam Postavsky @ 2018-09-08 2:16 UTC (permalink / raw) To: Davis Herring; +Cc: Stefan Monnier, Emacs developers On 6 September 2018 at 21:10, Davis Herring <herring@lanl.gov> wrote: >> with VAR bound to (ERROR-SYMBOL . SIGNAL-DATA) from the error. > > > You left one "ERROR" here. > > Meanwhile, it might be good to leave the word "error" somewhere in the text, > just so no one uninitiated reads it and decides it _isn't_ for error > handling. Yeah, hmm. Maybe it's not such a great idea to remove "error" everywhere just to cover some obscure corner case. Just mentioning that corner case specifically should be enough to get the idea across. A handler is applicable to an error if CONDITION-NAME is one of the -error's condition names. A CONDITION-NAME of t applies to any error -symbol. If an error happens, the first applicable handler is run. +error's condition names. Handlers may also apply when non-error +symbols are signaled (e.g., `quit'). A CONDITION-NAME of t applies to +any symbol, including non-error symbols. If multiple handlers are +applicable, only the first one runs. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-08 2:16 ` Noam Postavsky @ 2018-09-17 0:40 ` Noam Postavsky 0 siblings, 0 replies; 14+ messages in thread From: Noam Postavsky @ 2018-09-17 0:40 UTC (permalink / raw) To: Davis Herring; +Cc: Stefan Monnier, Emacs developers On 7 September 2018 at 22:16, Noam Postavsky <npostavs@gmail.com> wrote: > On 6 September 2018 at 21:10, Davis Herring <herring@lanl.gov> wrote: >> Meanwhile, it might be good to leave the word "error" somewhere in the text, >> just so no one uninitiated reads it and decides it _isn't_ for error >> handling. > > Yeah, hmm. Maybe it's not such a great idea to remove "error" > everywhere just to cover some obscure corner case. Just mentioning > that corner case specifically should be enough to get the idea across. No further comments, so I pushed to master. [1: 3a2ffa62a7]: 2018-09-16 20:25:45 -0400 Clarify condition-case docstring https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3a2ffa62a7e491fda1083cbedb165a3e49fd21c6 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 1:01 ` Noam Postavsky 2018-09-07 1:08 ` Stefan Monnier 2018-09-07 1:10 ` Davis Herring @ 2018-09-07 6:51 ` Eli Zaretskii 2018-09-07 7:00 ` Davis Herring [not found] ` <<83in3hvlyx.fsf@gnu.org> 3 siblings, 1 reply; 14+ messages in thread From: Eli Zaretskii @ 2018-09-07 6:51 UTC (permalink / raw) To: Noam Postavsky; +Cc: monnier, emacs-devel > From: Noam Postavsky <npostavs@gmail.com> > Date: Thu, 6 Sep 2018 21:01:31 -0400 > Cc: Emacs developers <emacs-devel@gnu.org> > > DEFUN ("condition-case", Fcondition_case, Scondition_case, 2, UNEVALLED, 0, > - doc: /* Regain control when an error is signaled. > -Executes BODYFORM and returns its value if no error happens. > + doc: /* Regain control when a condition is signaled. > +Executes BODYFORM and returns its value if nothing is signaled. > Each element of HANDLERS looks like (CONDITION-NAME BODY...) > where the BODY is made of Lisp expressions. > > -A handler is applicable to an error if CONDITION-NAME is one of the > -error's condition names. A CONDITION-NAME of t applies to any error > -symbol. If an error happens, the first applicable handler is run. > +A handler is applicable to a condition if CONDITION-NAME is one of the > +condition's names. A CONDITION-NAME of t applies to any condition ^^^^^^^^^^^ This should be "conditions'", I think, as it's plural. > +name. If a condition is signaled, the first applicable handler is run. I find "condition is signaled" slightly confusing, though. Why not use "signal" instead? A "signal" is not necessarily an error, so I think the root cause for this change will be taken care of. WDYT? ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 6:51 ` Eli Zaretskii @ 2018-09-07 7:00 ` Davis Herring 2018-09-07 7:24 ` Eli Zaretskii [not found] ` <<83ftylvkgw.fsf@gnu.org> 0 siblings, 2 replies; 14+ messages in thread From: Davis Herring @ 2018-09-07 7:00 UTC (permalink / raw) To: Eli Zaretskii, Noam Postavsky; +Cc: monnier, emacs-devel >> +A handler is applicable to a condition if CONDITION-NAME is one of the >> +condition's names. A CONDITION-NAME of t applies to any condition > ^^^^^^^^^^^ > This should be "conditions'", I think, as it's plural. No: the names are plural, but the condition (that has been signaled) is not. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-07 7:00 ` Davis Herring @ 2018-09-07 7:24 ` Eli Zaretskii [not found] ` <<83ftylvkgw.fsf@gnu.org> 1 sibling, 0 replies; 14+ messages in thread From: Eli Zaretskii @ 2018-09-07 7:24 UTC (permalink / raw) To: Davis Herring; +Cc: emacs-devel, npostavs, monnier > Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org > From: Davis Herring <herring@lanl.gov> > Date: Fri, 7 Sep 2018 01:00:26 -0600 > > >> +A handler is applicable to a condition if CONDITION-NAME is one of the > >> +condition's names. A CONDITION-NAME of t applies to any condition > > ^^^^^^^^^^^ > > This should be "conditions'", I think, as it's plural. > > No: the names are plural, but the condition (that has been signaled) is not. But "condition's names" means that a single condition has several names. Is that what we want to say there? ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <<83ftylvkgw.fsf@gnu.org>]
* RE: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) [not found] ` <<83ftylvkgw.fsf@gnu.org> @ 2018-09-07 15:19 ` Drew Adams 0 siblings, 0 replies; 14+ messages in thread From: Drew Adams @ 2018-09-07 15:19 UTC (permalink / raw) To: Eli Zaretskii, Davis Herring; +Cc: npostavs, monnier, emacs-devel > > >> +A handler is applicable to a condition if CONDITION-NAME is one of the > > >> +condition's names. A CONDITION-NAME of t applies to any condition > > > ^^^^^^^^^^^ > > > This should be "conditions'", I think, as it's plural. > > > > No: the names are plural, but the condition (that has been signaled) is not. > > But "condition's names" means that a single condition has several > names. Is that what we want to say there? No, it's not what we want to say here. But we also don't want to say "one of the conditions names". ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <<83in3hvlyx.fsf@gnu.org>]
* RE: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) [not found] ` <<83in3hvlyx.fsf@gnu.org> @ 2018-09-07 15:17 ` Drew Adams 0 siblings, 0 replies; 14+ messages in thread From: Drew Adams @ 2018-09-07 15:17 UTC (permalink / raw) To: Eli Zaretskii, Noam Postavsky; +Cc: monnier, emacs-devel > > +A handler is applicable to a condition if CONDITION-NAME is one of the > > +condition's names. A CONDITION-NAME of t applies to any condition > ^^^^^^^^^^^ > This should be "conditions'", I think, as it's plural. No. "one of the condition names" (as in the original, but without "error"). Or "the name of one of the conditions". ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) 2018-09-05 14:38 ` Noam Postavsky 2018-09-05 15:31 ` Stefan Monnier @ 2018-09-05 15:31 ` Stefan Monnier 1 sibling, 0 replies; 14+ messages in thread From: Stefan Monnier @ 2018-09-05 15:31 UTC (permalink / raw) To: Noam Postavsky; +Cc: Emacs developers >> (the only one I know of is `quit`, BTW). > That, and possible silly code which does something like: > (signal 'not-an-error-symbol "oops") I know there can hypothetically be others, but what I was saying above is that in practice I've only ever seen `quit`. Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-09-17 0:40 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20180904230314.12505.44942@vcs0.savannah.gnu.org> [not found] ` <20180904230315.6EB44209DC@vcs0.savannah.gnu.org> 2018-09-05 2:46 ` [Emacs-diffs] master 425c281 1/3: Allow t as a catch-all condition-case handler (Bug#24618) Stefan Monnier 2018-09-05 14:38 ` Noam Postavsky 2018-09-05 15:31 ` Stefan Monnier 2018-09-07 1:01 ` Noam Postavsky 2018-09-07 1:08 ` Stefan Monnier 2018-09-07 1:10 ` Davis Herring 2018-09-08 2:16 ` Noam Postavsky 2018-09-17 0:40 ` Noam Postavsky 2018-09-07 6:51 ` Eli Zaretskii 2018-09-07 7:00 ` Davis Herring 2018-09-07 7:24 ` Eli Zaretskii [not found] ` <<83ftylvkgw.fsf@gnu.org> 2018-09-07 15:19 ` Drew Adams [not found] ` <<83in3hvlyx.fsf@gnu.org> 2018-09-07 15:17 ` Drew Adams 2018-09-05 15:31 ` Stefan Monnier
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.