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

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Thu, 30 Aug 2012 23:10:01 UTC

Severity: normal

Found in version 24.2.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 12314 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 12314 <at> debbugs.gnu.org, cyd <at> gnu.org
Subject: Re: 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 <at> oracle.com>
> Cc: <12314 <at> 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.




This bug report was last modified 12 years and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.