unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* condition-case with multiple handlers
@ 2012-07-29  2:54 Jay Belanger
  2012-07-29  3:26 ` Herring, Davis
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Belanger @ 2012-07-29  2:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: jay.p.belanger


I'm dealing with a condition-case construct that has more than one
handler and I need some way to indicate (outside the construct) when any
one of the errors has occurred.  I could, for example, set a flag in
each handler: 
  (some-error
     (setq flag t)
     ...some stuff ...)
  (another-error
     (setq flag t)
     ...different stuff...)
Is there a better way to do this?

Jay



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: condition-case with multiple handlers
  2012-07-29  2:54 condition-case with multiple handlers Jay Belanger
@ 2012-07-29  3:26 ` Herring, Davis
  2012-07-29  4:25   ` Jay Belanger
  0 siblings, 1 reply; 4+ messages in thread
From: Herring, Davis @ 2012-07-29  3:26 UTC (permalink / raw)
  To: jay.p.belanger@gmail.com; +Cc: emacs-devel@gnu.org

> I'm dealing with a condition-case construct that has more than one
> handler and I need some way to indicate (outside the construct) when any
> one of the errors has occurred.

How about:

(let (noerror)
  (condition-case ...
    (progn
      ...
      (setq noerror t))
    (some-error ...)
    (other-error ...))
  ...)

Davis



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: condition-case with multiple handlers
  2012-07-29  3:26 ` Herring, Davis
@ 2012-07-29  4:25   ` Jay Belanger
  2012-07-29  4:44     ` Herring, Davis
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Belanger @ 2012-07-29  4:25 UTC (permalink / raw)
  To: Herring, Davis; +Cc: jay.p.belanger, emacs-devel@gnu.org


"Herring, Davis" <herring@lanl.gov> writes:

>> I'm dealing with a condition-case construct that has more than one
>> handler and I need some way to indicate (outside the construct) when any
>> one of the errors has occurred.
>
> How about:
>
> (let (noerror)
>   (condition-case ...
>     (progn
>       ...
>       (setq noerror t))
>     (some-error ...)
>     (other-error ...))
>   ...)

Good idea, but it messes with the return value of the condition-case
body.  I thought there might be some built-in method for handling this,
but I'm thinking not.

Jay




^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: condition-case with multiple handlers
  2012-07-29  4:25   ` Jay Belanger
@ 2012-07-29  4:44     ` Herring, Davis
  0 siblings, 0 replies; 4+ messages in thread
From: Herring, Davis @ 2012-07-29  4:44 UTC (permalink / raw)
  To: jay.p.belanger@gmail.com; +Cc: emacs-devel@gnu.org

> >     (progn
> >       ...
> >       (setq noerror t))
> 
> Good idea, but it messes with the return value of the condition-case
> body.  I thought there might be some built-in method for handling this,
> but I'm thinking not.

I didn't know its value mattered, but you can just use prog1...

Davis


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-29  4:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-29  2:54 condition-case with multiple handlers Jay Belanger
2012-07-29  3:26 ` Herring, Davis
2012-07-29  4:25   ` Jay Belanger
2012-07-29  4:44     ` Herring, Davis

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).