From: Drew Adams <drew.adams@oracle.com>
To: "'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'" <help-gnu-emacs@gnu.org>
Subject: Advice functions: required args that byte-compiler warns are unused
Date: Wed, 3 Nov 2021 17:53:09 +0000 [thread overview]
Message-ID: <SJ0PR10MB5488BC2AAC9C79E533B0B366F38C9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
I'm wondering how you deal with this - what's a
good way.
I have an advice function `my-foo-after-advice',
which I use as an :after advice for function `foo':
(defun my-foo-after-advice (&rest args)
"..."
(ignore args) ; Quiet the byte-compiler.
(do-stuff-that-doesnt-refer-to-ARGS))
Suppose function `foo' requires 3 arguments:
(defun foo (a b c) ...)
An :after advice needs to accept the same args as
the function it advises. But the byte-compiler
warns "Unused lexical argument 'args'" (naturally).
So I've been adding an `(ignore args)'.
Is there a better way to suppress such a warning?
I looked for a `declare' possibility for this,
which would be a declaration to the byte-compiler
rather than a runtime operation.
Of course `ignore' doesn't cost much here, but it
seems like we should be able to keep info for the
compiler separate from code that gets run.
Hope I'm missing something simple.
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13492 bytes --]
next reply other threads:[~2021-11-03 17:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 17:53 Drew Adams [this message]
2021-11-03 19:04 ` Advice functions: required args that byte-compiler warns are unused Stefan Monnier via Users list for the GNU Emacs text editor
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=SJ0PR10MB5488BC2AAC9C79E533B0B366F38C9@SJ0PR10MB5488.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).