From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#33998: 27.0.50; cl-delete does not delete the first list element Date: Tue, 8 Jan 2019 10:22:42 -0800 (PST) Message-ID: References: <87muodud4d.fsf@aia00054aia.gr> <39367b1c-ea27-4627-99e3-eb7d0745c60f@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1546971670 5591 195.159.176.226 (8 Jan 2019 18:21:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Jan 2019 18:21:10 +0000 (UTC) Cc: 33998@debbugs.gnu.org, Deus Max To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 08 19:21:06 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggvzs-0001Iv-Va for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Jan 2019 19:21:05 +0100 Original-Received: from localhost ([127.0.0.1]:40238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggw1z-0007o4-9G for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Jan 2019 13:23:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggw1m-0007lb-TH for bug-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:23:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggw1m-00085k-54 for bug-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:23:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggw1l-00084p-Vi for bug-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ggw1l-0002uw-PX for bug-gnu-emacs@gnu.org; Tue, 08 Jan 2019 13:23:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Jan 2019 18:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33998 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 33998-submit@debbugs.gnu.org id=B33998.154697177811193 (code B ref 33998); Tue, 08 Jan 2019 18:23:01 +0000 Original-Received: (at 33998) by debbugs.gnu.org; 8 Jan 2019 18:22:58 +0000 Original-Received: from localhost ([127.0.0.1]:50237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggw1h-0002uS-Vm for submit@debbugs.gnu.org; Tue, 08 Jan 2019 13:22:58 -0500 Original-Received: from userp2130.oracle.com ([156.151.31.86]:50238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggw1g-0002uD-O9 for 33998@debbugs.gnu.org; Tue, 08 Jan 2019 13:22:57 -0500 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x08IE5tv046484; Tue, 8 Jan 2019 18:22:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=ldU+hj/s86ynK4FUm65Urz3ZZeLlc2Z+VwP8RgTwyU4=; b=G5CKyEKB/3rnCyN/BkDVeI4VUDn9PfOuDaNw5dl2hhwCRtk5L7uqYtGpLqAljWDYJEjW 9UlmWMmDxgdOVsUXMYaNcScmEeKYeSuy1sEjHq55v9FKfnCrtvs2gy6t9j3hkyhL5g1p lDuauA8y1wgOWk44OGgu7tjO/Fl9gAkOD7srUnNNRTHtpU/HG6jeIjA42heLB9bLthBk c/j//9CJny9cb4rc7jB0d96x1RZpjhBPBUbBAqegxDJoM2I88Te/+vAE5Tuc9v/kEDmu s7pUmzOsei6PM8z9sGvUb6PtdgdkqooA1XymSD2WuoYaGVM5HhF/+sPdQcrGQeOQ5zy4 eQ== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ptm0u58n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 Jan 2019 18:22:50 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x08IMj3B030599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Jan 2019 18:22:45 GMT Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x08IMhQv001532; Tue, 8 Jan 2019 18:22:43 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4783.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9130 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=385 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901080146 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154265 Archived-At: > > > > > So, cumbersome as it is, you should always use: > > > > ^^^^^^^^^^^^^ > > > > > (setq seq (cl-delete thing seq)) > > > > > > > > FWIW, this is not really true. > > > > > > > > `cl-delete' deletes THING from the > > > > _value_ of SEQ. You might or you > > > > might not want variable SEQ to have > > > > the updated value. > > > > > > But this is what he wanted, so what's > > > the point in making this more confusing > > > than it needs to be? > > > > It's enough to suggest that he might want > > to do that, and point to the manual for > > explanation. It's the "always" that's > > misleading. >=20 > Actually, as I've subsequently demonstrated > the leeway given to cl-delete by the CL spec > is such that it is quite a good idea to *always* > use the (setq SEQ (cl-delete THING SEQ)) idiom, > because you have no control on what cl-delete > does with SEQ. You might indeed not want it > changed but it may change, and not in ways > you can predict. No. This has nothing to do with CL or the CL spec or the implementation of `cl-delete'. Again, you should set the variable to the value returned by `cl-delete' only if that's what you want - only if you want the variable to point to the result of the operation instead of what it pointed to previously. This is so, regardless of what the result of that operation might be - regardless of how `cl-delete' is implemented or even what it might do. It's about the difference between a variable and its value. `cl-delete' can only act on the value, not on the variable (it never sees the variable). Only other code can decide whether the variable should be set to the return value of `cl-delete'. If yes, then `setq'; if no, then no `set'`. Pretty simple, really.