[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Warning: `mapcar' called for effect; use `mapc' or...



Hi,

The most recent Emacs CVS warns about the use of mapcar when
compling emacs-w3m as follows:

In w3m-session-save:
w3m-session.el:126:6:Warning: `mapcar' called for effect; use `mapc' or
    `dolist' instead

In w3m-session-select:
w3m-session.el:242:8:Warning: `mapcar' called for effect; use `mapc' or
    `dolist' instead

In toplevel form:
shimbun/sb-tdiary.el:162:8:Warning: `mapcar' called for effect; use `mapc' or
    `dolist' instead

The beginning two warnings are proper.  Using mapc or dolist makes
the programs run fast, though it is not necessarily necessary.
However, the last one is improper.  The code warned is:

(luna-define-method shimbun-groups ((shimbun shimbun-tdiary))
  (mapcar 'car shimbun-tdiary-group-alist))

It should return a list of the `car's of `shimbun-tdiary-group-alist'.
Why it is warned may be that the bytecomp doesn't know what the
`luna-define-method' macro does.  Any idea?  I think pulling out
the `mapcar' element from `byte-compile-warnings' is not a good idea.

Regards,