bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'


From: Drew Adams
Subject: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'
Date: Sat, 8 Sep 2012 07:57:12 -0700

> Does this mean the ELisp manual is in error?  It says:
> 
>  -- Function: delete object sequence
>      If `sequence' is a list, this function destructively removes all
>      elements `equal' to OBJECT from SEQUENCE.
>      ...
>      If `sequence' is a vector or string, `delete' returns a copy of
>      `sequence' with all elements `equal' to `object' removed.
> 
> 'history' is a list, isn't it?

Yes, it is a list.  What is your point/question?

Keep reading the same section of the manual (section for `delete'):

  ;; If you want to change `l' reliably,
  ;; write `(setq l (delete '(2) l))'.

There is more explanation higher up in the same node, under `delq':

 Don't assume that a variable
 which formerly held the argument LIST now has fewer elements,
 or that it still holds the original list!  Instead, save the
 result of `delq' and use that.  Most often we store the result
 back into the variable that held the original list:

     (setq flowers (delq 'rose flowers))

I would imagine that you already know this, so I'm likely missing something in
your question.  But if you don't already know this, or if you knew it but forgot
it, there's no harm/shame in that.  Does this help, or were you referring to
something else?






reply via email to

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