unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] scratch/so-long 7273fb2: Add so-long library
Date: Sun, 14 Apr 2019 11:14:47 -0400	[thread overview]
Message-ID: <jwv4l70k4pt.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <e2d28d85-5fef-b765-a094-32b8ddbd0612@orcon.net.nz> (Phil Sainty's message of "Mon, 15 Apr 2019 01:09:16 +1200")

>>     (advice-add 'hack-local-variables :around #'so-long--hlv)
>>     (defun so-long--hlv (orig-fun &optional handle-mode &rest args)
>>       ;; The first arg to `hack-local-variables' is HANDLE-MODE since
> Emacs 26.1,
>>       ;; and MODE-ONLY in earlier versions.  In either case we are
> interested in
>>       ;; whether it has the value `t'.
>>       (let ((retval (apply orig-fun handle-mode args)))
>>         (and (eq handle-mode t)
>>              retval ; A file-local mode was set.
>>              (so-long-handle-file-local-mode retval))))
>
> This is changing 'after' advice into 'around' advice, which means that
> your version changes the return value, so that's definitely not
> equivalent.

Oops, indeed, sorry.

> I've changed it to explicitly return retval.

Good, thanks.

> Can nadvice not do 'after' advice which knows the arguments?

The arguments, yes, but the just-computed return value, no.

> The "Files with a file-local 'mode'" section of the Commentary says
> much the same, but I'd not yet added that at the time you queried
> this.  I think that ought to provide the missing context for readers
> (as otherwise I think all the advice is documented pretty clearly?)

I must admit that I do a lot of hacking on packages I never use, so
I like it when the code explains what it does without requiring the
coder to have read the doc ;-)

>>> Such changes will need to work in Emacs 25 at least, and ideally
>>> back to 24.3
>> advice-add was added to Emacs-24.4 and it is available in GNU ELPA
>> for earlier Emacsen, so it's OK.
> So: Package-Requires: ((emacs "24.3") nadvice), yes?
> No -- experimentally that causes Emacs 26.1 to install nadvice from
> ELPA instead of deferring to the library it already has.

IIUC that's a bug in Emacs-26.1 (and 26.2) because 26.[12] is not aware
that it comes with nadvice-1.0.

It really should have been fixed before Emacs-26.2, but I somehow forgot
to push that commit and it lingered on a machine I only used again
very recently :-(


        Stefan



  reply	other threads:[~2019-04-14 15:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190107065207.21793.53271@vcs0.savannah.gnu.org>
     [not found] ` <20190107065208.BA36C21736@vcs0.savannah.gnu.org>
2019-01-10 18:07   ` [Emacs-diffs] scratch/so-long 7273fb2: Add so-long library Stefan Monnier
2019-01-12  2:20     ` Phil Sainty
2019-01-12 15:11       ` Stefan Monnier
2019-01-12 21:01         ` Stefan Monnier
2019-04-14 13:09         ` Phil Sainty
2019-04-14 15:14           ` Stefan Monnier [this message]
2019-04-14 22:33             ` Phil Sainty
2019-06-27 13:46               ` Performance degradation from long lines Phil Sainty
2019-07-06 14:18                 ` Phil Sainty
2019-07-13  8:07                   ` Eli Zaretskii
2019-07-13  9:07                     ` Stefan Kangas
2019-07-13  9:51                       ` Eli Zaretskii
2019-07-13 10:23                         ` Stefan Kangas
2019-07-13 10:29                           ` Eli Zaretskii
2019-07-13 10:38                             ` Stefan Kangas
2019-07-13 10:58                               ` Phil Sainty
2019-07-13 11:23                                 ` Eli Zaretskii
2019-07-13 11:23                               ` Eli Zaretskii
2019-07-13  9:33                     ` Phil Sainty
2019-07-13  9:56                       ` Eli Zaretskii
2019-07-13 13:31                         ` Stefan Monnier
2019-07-13 13:43                           ` Stefan Kangas
2019-07-13 14:14                           ` Eli Zaretskii
2019-07-13 14:17                             ` Stefan Monnier
2019-07-13 18:17                               ` Eli Zaretskii
2019-07-13 22:22                                 ` Stefan Monnier
2019-07-14  5:39                                   ` Eli Zaretskii
2019-07-15 13:12                                     ` Dmitry Gutov
2019-07-18  6:30                                       ` Eli Zaretskii
2019-07-18 14:48                                         ` Stefan Monnier
2019-07-18 17:11                                           ` Clément Pit-Claudel
2019-07-18 18:11                                             ` Stefan Monnier
2019-07-18 18:33                                           ` Andy Moreton

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv4l70k4pt.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=psainty@orcon.net.nz \
    /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 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).