From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: Last use of defadvice in Emacs
Date: Fri, 8 Apr 2022 18:06:32 +0000 [thread overview]
Message-ID: <YlB5qDzLimGWNOht@ACM> (raw)
In-Reply-To: <jwvczhr4gw7.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Fri, Apr 08, 2022 at 13:39:58 -0400, Stefan Monnier wrote:
> >> (defmacro url-http-ntlm--if-when-compile (cond &rest body)
> >> (declare (debug t) (indent 1))
> >> (when (eval cond)
> >> `(progn ,@body)))
> >> ;; Remove authorization after redirect.
> >> (url-http-ntlm--if-when-compile
> >> (and (boundp 'emacs-major-version)
> >> (< emacs-major-version 25))
> >> ...
> >> ... Various code, including, incidentally, a `defadvice` ...
> >> ...)
> > Here, a piece of `byte-code' gets compiled for the
> > url-http-ntlm--if-when-compile call. This is useless code without any
> > useful function. (I've just tried it.)
> That bytecode implements your #if feature. So if we care about that
> feature, we'd remove the `url-http-ntlm--` prefix and move it to
> lisp/subr.el, indeed.
Apologies, you are right. That piece of byte code is indeed part of the
macro's definition, not something generated by it. I tried compiling a
source file with just (require ...) (defun foo ...)
(url-http-ntlm--if-when-compile ..) and (defun bar ...), and in the
..elc, the foo and the bar had nothing intervening between them.
> I agree that Emacs does not come with the equivalent of #if but the
> above macro shows that it can be implemented quite easily if we care to
> provide it.
Yes. :-)
[ .... ]
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
prev parent reply other threads:[~2022-04-08 18:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 19:49 Last use of defadvice in Emacs Stefan Monnier
2022-04-04 20:08 ` T.V Raman
2022-04-04 20:38 ` Stefan Monnier via CC-Mode-help
2022-04-04 20:48 ` T.V Raman
2022-04-05 4:28 ` Richard Stallman
2022-04-06 18:52 ` Alan Mackenzie
2022-04-06 21:08 ` Stefan Monnier via CC-Mode-help
2022-04-07 1:51 ` T.V Raman
2022-04-07 2:49 ` Stefan Monnier via CC-Mode-help
2022-04-07 6:14 ` Eli Zaretskii
2022-04-07 21:59 ` Stefan Monnier via CC-Mode-help
2022-04-08 1:49 ` T.V Raman
2022-04-08 2:34 ` Stefan Monnier via CC-Mode-help
2022-04-08 14:21 ` T.V Raman
2022-04-08 6:00 ` Eli Zaretskii
2022-04-07 18:18 ` Alan Mackenzie
2022-04-07 18:37 ` Stefan Monnier
2022-04-08 17:10 ` Alan Mackenzie
2022-04-08 17:39 ` Stefan Monnier via CC-Mode-help
2022-04-08 18:06 ` Alan Mackenzie [this message]
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=YlB5qDzLimGWNOht@ACM \
--to=acm@muc.de \
--cc=bug-cc-mode@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.