emacs-devel
[Top][All Lists]
Advanced

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

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


From: Dan Nicolaescu
Subject: Re: Warning: `mapcar' called for effect; use `mapc' or `dolist'
Date: Mon, 22 Oct 2007 13:07:40 -0700

Reiner Steib <address@hidden> writes:

  > On Mon, Oct 22 2007, Katsumi Yamaoka wrote:
  > 
  > >>>>>> Dan Nicolaescu wrote:
  > >> The subject is about a new warning produced by the byte
  > >> compiler. There's a lot of those for gnus.
  > >> Assuming that all emacs versions that gnus wants to support have
  > >> either mapc or dolist, can somebody please take care of these
  > >> warnings?
  > >
  > >> Thanks
  > >
  > > With No Gnus v0.7 I did `cd lisp; make warn' and tried replacing
  > > of `mapcar' with `mapc', `dolist', or `while' loops for a while,
  > > and realized it's not easy and not safe.  Ones who do it will
  > > need to study what things using `mapcar' do in all cases.  For
  > > instance, `mapcar' used in `gnus-group-highlight-line' cannot be
  > > replaced with `mapc' even if the compiler warns it.  
  > 
  > Could the byte-compiler be improved not to warn about such cases?
  > Here's the relevant code:
  > 
  > (defun gnus-group-highlight-line ()
  >   "Highlight the current line according to `gnus-group-highlight'."
  >   (let* ([...]
  >      (mailp (apply 'append
  >                    (mapcar
  >                     (lambda (x)
  >                       (memq x (assoc (symbol-name
  >                                       (car (or method gnus-select-method)))
  >                                      gnus-valid-select-methods)))
  >                     '(mail post-mail))))
  >      (level (or (gnus-info-level info) gnus-level-killed))

It seems that `mailp' is not used in that function. Adding a use for
it makes the warning go away...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]