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: Chong Yidong
Subject: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'
Date: Sun, 09 Sep 2012 15:53:34 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> But the manual should cater first and foremost to newbies.  The rest
> will get the point when they read the detailed description of how the
> list is modified.

I modified the manual to hopefully make the situation clearer.  In
particular, the descriptions of delq and delete explicitly say that you
typically ought to use the return value.

The docstrings are harder, since they should be succinct.  Here is what
I suggest; WDYT?


(delq ELT LIST)

Delete by side effect occurrences of ELT as a member of LIST.
Comparison is done with `eq'.  Return the resulting list.

More precisely, this function skips any occurrences of ELT at the
front of LIST, then removes occurrences of ELT from the remaining
sublist by modifying the list structure, then returns the resulting
sublist.

Therefore, write `(setq foo (delq element foo))' to be sure of
changing the value of `foo'.


(delete ELT SEQ)

Delete occurrence of ELT as a member of SEQ.
SEQ must be a sequence (i.e. a list, a vector, or a string).
Comparison is done with `equal'.  Return the resulting sequence.

If SEQ is a list, this behaves like `delq', except that it compares
with `equal' instead of `eq'.  In particular, it may remove elements
by altering the list structure.

If SEQ is not a list, deletion is not a side effect; this function
creates and returns a new sequence.

Therefore, write `(setq foo (delete element foo))'
to be sure of changing the value of `foo'.





reply via email to

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