all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 4ffdcfc: Nudge WoMan toward lexical-binding
       [not found] ` <20160810042245.914B52201C2@vcs.savannah.gnu.org>
@ 2016-08-25  4:48   ` Stefan Monnier
  2016-09-27 17:43     ` Mark Oteiza
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2016-08-25  4:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mark Oteiza

> -		      (add-to-list 'manpath
> -				   (if (match-beginning 1)
> -				       (match-string 1)
> -				     (cons (match-string 2)
> -					   (match-string 3)))))
> +                      (cl-pushnew (if (match-beginning 1)
> +                                      (match-string 1)
> +                                    (cons (match-string 2)
> +                                          (match-string 3)))
> +                                  manpath))

cl-pushnew uses `eql` (contrary to add-to-list which uses `equal`) for
equality testing.  So when applied to value that have just been
constructed by `cons` and `match-string`, it will do exactly the same as
`push` would.

IOW I think you need to add

    :test #'equal

as arg to many of those cl-pushnew you introduced.  Note that in my
experience there are also some `add-to-list`s which don't actually care
about equality testing at all and can just be replaced by a simple
`push`.


        Stefan



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

* Re: [Emacs-diffs] master 4ffdcfc: Nudge WoMan toward lexical-binding
  2016-08-25  4:48   ` [Emacs-diffs] master 4ffdcfc: Nudge WoMan toward lexical-binding Stefan Monnier
@ 2016-09-27 17:43     ` Mark Oteiza
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Oteiza @ 2016-09-27 17:43 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 25/08/16 at 12:48am, Stefan Monnier wrote:
> > -		      (add-to-list 'manpath
> > -				   (if (match-beginning 1)
> > -				       (match-string 1)
> > -				     (cons (match-string 2)
> > -					   (match-string 3)))))
> > +                      (cl-pushnew (if (match-beginning 1)
> > +                                      (match-string 1)
> > +                                    (cons (match-string 2)
> > +                                          (match-string 3)))
> > +                                  manpath))
> 
> cl-pushnew uses `eql` (contrary to add-to-list which uses `equal`) for
> equality testing.  So when applied to value that have just been
> constructed by `cons` and `match-string`, it will do exactly the same as
> `push` would.
> 
> IOW I think you need to add
> 
>     :test #'equal
> 
> as arg to many of those cl-pushnew you introduced.

Thanks, fixed in 329e0274.

> Note that in my experience there are also some `add-to-list`s which
> don't actually care about equality testing at all and can just be
> replaced by a simple `push`.

Some of these probably should have been push, in this particular case
I suppose it makes little difference. Thanks again.



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

end of thread, other threads:[~2016-09-27 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20160810042245.19283.98654@vcs.savannah.gnu.org>
     [not found] ` <20160810042245.914B52201C2@vcs.savannah.gnu.org>
2016-08-25  4:48   ` [Emacs-diffs] master 4ffdcfc: Nudge WoMan toward lexical-binding Stefan Monnier
2016-09-27 17:43     ` Mark Oteiza

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.