From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-devel@gnu.org
Subject: Byte-compiler warnings for todo-mode.el
Date: Sun, 05 Aug 2018 22:57:02 +0200 [thread overview]
Message-ID: <87zhy0fs69.fsf@gmx.net> (raw)
After changes I made in master f7d65a5, byte-compiling todo-mode.el now
produces these warnings:
todo-mode.el:4048:1:Warning: Unused lexical variable ‘sfnlist’
In end of data:
todo-mode.el:6785:1:Warning: the function ‘hl-line-highlight’ might not be
defined at runtime.
The first warning is due to code containing the following lines:
(let (... falist sfnlist ...)
(dolist (f files)
...
(push (...) falist))
(setq sfnlist (mapcar #'car falist))
(setq file (completing-read "Choose a filtered items file: "
falist nil t nil 'sfnlist (caar falist)))
...)
So sfnlist is a list produced on the fly as the HIST argument of
completing-read, which is required to be a symbol. I checked a few
examples in the emacs sources and all instances of the HIST argument
were defvar'd variables. In the above todo-mode.el case, it seems like
overkill to add a global variable that has no other use than the above.
Given this, is it acceptable to leave the warning or is it preferable to
add a defvar to suppress it?
The second warning is due to this line:
(if (and (boundp 'hl-line-mode) hl-line-mode) (hl-line-highlight))
The warning can be prevented with (eval-and-compile (require 'hl-line)).
In fact, I use that elsewhere in todo-mode.el when hl-line-mode is
actually enabled, so that when the function the above line of code is
part of is executed, either hl-line.el is already loaded and
hl-line-highlight is defined, or hl-line-mode is nil, so
(hl-line-highlight) won't be evaluated and hence it doesn't matter if
it's not defined. Given this, is it acceptable to leave the warning or
is it preferable to suppress it? (I already added the above boundp
check to suppress the warning "reference to free variable
`hl-line-mode'"; would it have been acceptable to leave this warning as
well?)
Steve Berman
next reply other threads:[~2018-08-05 20:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-05 20:57 Stephen Berman [this message]
2018-08-06 1:23 ` Byte-compiler warnings for todo-mode.el Stefan Monnier
2018-08-06 8:49 ` Stephen Berman
2018-08-06 15:32 ` Stefan Monnier
2018-08-06 15:56 ` Stefan Monnier
2018-08-06 16:30 ` Stephen Berman
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=87zhy0fs69.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=emacs-devel@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.
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.