unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Byte-compiler warnings for todo-mode.el
@ 2018-08-05 20:57 Stephen Berman
  2018-08-06  1:23 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Berman @ 2018-08-05 20:57 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-06 16:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-05 20:57 Byte-compiler warnings for todo-mode.el Stephen Berman
2018-08-06  1:23 ` 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

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).