From: Niklas Eklund <niklas.eklund@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/detached 827e3d64fe: Bug fix: Incorrect initialization of projectile
Date: Thu, 25 Aug 2022 18:30:11 +0000 [thread overview]
Message-ID: <eruuehmtbs18i4.fsf@posteo.net> (raw)
In-Reply-To: <jwv8rngqc0d.fsf-monnier+emacs@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Hi Stefan,
> Hi Niklas,
>
>> @@ -150,7 +150,7 @@
>>
>> (defun detached-init--projectile ()
>> "Initialize integration with `projectile'."
>> - (when (functionp #'projectile)
>> + (when (featurep 'projectile)
>> (advice-add 'projectile-run-compilation
>> :override #'detached-extra-projectile-run-compilation)))
>>
>
> I suspect that you can then also remove the corresponding
> `declare-function`.
> More importantly, `advice-add` can be used on a symbol whose function is
> not yet defined, so you can skip the `when` test altogether.
That's very neat that the check can be skipped, thanks for the
suggestion!
> The same applies to the following:
>
> (when (functionp #'dired-rsync)
> (advice-add #'dired-rsync--do-run :override #'detached-extra-dired-rsync)))
>
> where my stylistic checker additionally complains about:
> - #' kind of says that `dired-rsync` is a function, so using `functionp`
> on it is a bit weird. Usually, code does (fboundp 'dired-rsync)
> instead.
Aha, I had been thinking it should be quoted since it was a function but
now I understand that better. Btw what stylistic checker are you running
that shows you this? :)
> - `advice-add` takes as first argument a symbol. That symbol is
> expected to contains a function, indeed, but it can't just take any
> function (e.g. a (lambda ...) would be an error), for that reason
> I think using ' rather than #' is preferable (e.g. if you consider
> that Common Lisp (and `cl-flet`) will treat #'<symbol> as a reference
> to the function stored in the symbol (much like `symbol-function`)
> rather than as the symbol itself).
That make sense with the lambda example, thanks for the explenation!
>
> Stefan
/Niklas
prev parent reply other threads:[~2022-08-25 18:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <166119825097.26859.927185263202609197@vcs2.savannah.gnu.org>
[not found] ` <20220822195731.3F972C0088A@vcs2.savannah.gnu.org>
2022-08-22 20:15 ` [elpa] externals/detached 827e3d64fe: Bug fix: Incorrect initialization of projectile Stefan Monnier
2022-08-25 18:30 ` Niklas Eklund [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
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=eruuehmtbs18i4.fsf@posteo.net \
--to=niklas.eklund@posteo.net \
--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 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).