From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: cl-delete-if vs list of overlays Date: Wed, 9 Dec 2020 08:14:00 -0800 (PST) Message-ID: <37eda673-f866-4116-8d75-10231da38b28@default> References: <87zh2nfgq1.fsf@omarpolo.com> <874kkv706i.fsf@gnuvola.org> <87wnxrfdea.fsf@omarpolo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19395"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Omar Polo , Thien-Thi Nguyen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 09 17:14:57 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kn27F-0004uE-0Z for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Dec 2020 17:14:57 +0100 Original-Received: from localhost ([::1]:48374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kn27E-0005ui-2H for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 09 Dec 2020 11:14:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kn26T-0005tu-J3 for help-gnu-emacs@gnu.org; Wed, 09 Dec 2020 11:14:09 -0500 Original-Received: from userp2130.oracle.com ([156.151.31.86]:49220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kn26R-0000gO-Hm for help-gnu-emacs@gnu.org; Wed, 09 Dec 2020 11:14:09 -0500 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B9GA2mD099261; Wed, 9 Dec 2020 16:14:04 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-2020-01-29; bh=nQMq0bRSZaNdIx0JFM0e1jKNgeOD00XYpmqn5axfFDE=; b=XSiydztWCJhMSKlKEdzIqD4QS22j5jStX/3YDX4wsO4OL5zetXtLGjCAg0b/ZGKOKapm tk3HMXAkeJzPBms17MM485TD4ZMODFj4pxyO6K/BSltCl5Y066VfqI5creGPb+xu5vax NFRPmQbAYrt77Tmk8Jo3b2XnBzmdLQpTYNY9mEmTQvil67BhWA0V0srvPpv+iuQE9rud fMt1z7q6bIZQ95NwQUsVmo1JBz4brCvqZjP8cR6+ePN26zmMp36/5blsxcmd1dpB8Qpe 4Usad44rE1bGwCwyLYik31JkwLkO55ECDCL1ACiVMSxDj+gH/q18bQUXDelukvfIAUas IA== Original-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 3581mr0ws0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 09 Dec 2020 16:14:04 +0000 Original-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0B9GAjbw112107; Wed, 9 Dec 2020 16:14:03 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 358kyuwh5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Dec 2020 16:14:03 +0000 Original-Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0B9GE1eC005567; Wed, 9 Dec 2020 16:14:01 GMT In-Reply-To: <87wnxrfdea.fsf@omarpolo.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5071.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9829 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012090113 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9829 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 clxscore=1011 malwarescore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012090113 Received-SPF: pass client-ip=156.151.31.86; envelope-from=drew.adams@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126189 Archived-At: > I was under the (wrong) assumption that a destructive function will > always modify the list, when it's not the case. I needed to setq the > result of cl-delete-if to the list itself to cover all the cases. Yes. When you pass a list-valued variable to a "destructive" function you pretty much always want to set the variable to the result. `C-h i' Elisp manual `i destructive list operations' And `g Sets and Lists' tells us, about using `delq': Don=E2=80=99t 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 =E2=80=98delq=E2=80=99 and use that. Most often we store the result back into the variable that held the original list: