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: Eli Zaretskii
Subject: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'
Date: Sat, 08 Sep 2012 18:20:01 +0300

> From: "Drew Adams" <drew.adams@oracle.com>
> Cc: <12314@debbugs.gnu.org>
> 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?

That for a list, assigning the result is not necessary.  At least
that's my interpretation of what the manual says.

> Keep reading the same section of the manual (section for `delete'):
> 
>   ;; If you want to change `l' reliably,
>   ;; write `(setq l (delete '(2) l))'.

My interpretation of "reliably" here is "without assuming that l is a
list".  Is that a wrong interpretation?

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

'delq' is not identical to 'delete', so assumptions that somethiong
described there is pertinent to 'delete' are unsafe.  And how should
the reader know that she needs to read something under 'delq' to fully
understand what 'delete' does, anyway?

> I would imagine that you already know this, so I'm likely missing something in
> your question.

I'm not sure who is missing what.  All I'm saying is that the manual
seems to suggest that an explicit assignment is unnecessary, and yet
Chong did exactly that.  If just "(delete 'foo bar)", with 'bar' a
list, is sometimes not enough, the manual should say when.  And if it
is enough, why should we make the change in add-to-history?

IOW, it sounds like some kind of black magic is going on under the
hood, but the manual is too shy to talk about it.  It shouldn't; doing
so could easily spread confusion.  I'm not sure the code in question
was written as it was due to that confusion.





reply via email to

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