all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 39385@debbugs.gnu.org
Subject: bug#39385: Erroneous interaction of eval-when-compile and condition-case
Date: Sun, 2 Feb 2020 13:20:24 +0000	[thread overview]
Message-ID: <20200202132024.GB5547@ACM> (raw)
In-Reply-To: <87o8uhby0k.fsf@gmail.com>

Hello, Noam.

On Sat, Feb 01, 2020 at 20:04:11 -0500, Noam Postavsky wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (defmacro c-safe (&rest body)
> >   ;; safely execute BODY, return nil if an error occurred
> >   `(condition-case nil
> >        (progn ,@body)
> >      (error nil)))

> > (defmacro foo ()
> >   (error "This message should not be seen"))

> > (eval-when-compile
> >   (c-safe (foo)))
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> > Now do M-x byte-compile-file <CR> bad-eval-when-compile.el <CR>.  This
> > erroneously throws the error:

> >     This message should not be seen

> The same happens without eval-when-compile.

> > .  This should have been caught by the condition-case generated by
> > (c-safe ...).

> I don't think so, because the condition-case is in the code generated by
> c-safe (because the condition-case is quoted), whereas the error is
> signaled while generating the code (because the error call is not
> quoted).

Ah, I think I've got it.  The macro is being expanded before the
condition-case is active, and this is when it throws the error.

Thanks for the help.

I'll close this as notabug.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2020-02-02 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-01 21:47 bug#39385: Erroneous interaction of eval-when-compile and condition-case Alan Mackenzie
2020-02-02  1:04 ` Noam Postavsky
2020-02-02 13:20   ` Alan Mackenzie [this message]
2020-02-02 15:37   ` Alan Mackenzie

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20200202132024.GB5547@ACM \
    --to=acm@muc.de \
    --cc=39385@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

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

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

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

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