From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Niklas Eklund <niklas.eklund@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/detached 827e3d64fe: Bug fix: Incorrect initialization of projectile
Date: Mon, 22 Aug 2022 16:15:52 -0400 [thread overview]
Message-ID: <jwv8rngqc0d.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20220822195731.3F972C0088A@vcs2.savannah.gnu.org> (ELPA Syncer's message of "Mon, 22 Aug 2022 15:57:31 -0400 (EDT)")
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.
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.
- `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).
Stefan
next parent reply other threads:[~2022-08-22 20:15 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 ` Stefan Monnier [this message]
2022-08-25 18:30 ` [elpa] externals/detached 827e3d64fe: Bug fix: Incorrect initialization of projectile Niklas Eklund
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=jwv8rngqc0d.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=niklas.eklund@posteo.net \
/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).