all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: bug-cc-mode@gnu.org, acm@muc.de, emacs-devel@gnu.org, raman@google.com
Subject: Re: Last use of defadvice in Emacs
Date: Thu, 07 Apr 2022 09:14:47 +0300	[thread overview]
Message-ID: <834k35ctd4.fsf@gnu.org> (raw)
In-Reply-To: <jwvr1697hj5.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Wed, 06 Apr 2022 22:49:08 -0400)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Alan Mackenzie <acm@muc.de>,  bug-cc-mode@gnu.org,  emacs-devel@gnu.org
> Date: Wed, 06 Apr 2022 22:49:08 -0400
> 
> > Could you give some tips on what issues one might see with defadvice
> > and its disrespect of lexical bindings?
> 
> IIRC for existing pieces of advice the main issue can occur if an advice
> accesses the formal arguments by their name rather than via things like
> `ad-get-arg`.  IIRC we managed to get it working like it used to in most
> cases, but it's not very robust.
> 
> The other issue is that the body of `defadvice` is always evaluated in
> the dynamically scoped dialect of ELisp.  This means that its local vars
> can "leak" to some of the functions they call (as is normal with
> dynamic scoping) and that they can't refer to surrounding lexical
> variables (more common with `ad-make-advice` than with `defadvice` since
> that one is usually used at top-level), ...
> 
> Those problems aren't new.  What's "new" is that `advice-add` doesn't
> suffer from them.

It would be nice if these issues (perhaps in less academic shape and
in more practical terms) could be added to the ELisp manual, because
AFAICT we currently lack any rationale for people not to use
defadvice.



  reply	other threads:[~2022-04-07  6:14 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 [this message]
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

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=834k35ctd4.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=raman@google.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.