From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Locating file via load-path Date: Fri, 9 Aug 2024 18:51:32 +0200 Message-ID: References: <868qx6n9ug.fsf@gnu.org> <86zfpml0sq.fsf@gnu.org> 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="31516"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Eli Zaretskii , Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 09 18:52:36 2024 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 1scSqy-0007yR-2L for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 09 Aug 2024 18:52:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1scSqA-0003XB-GW; Fri, 09 Aug 2024 12:51:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scSq7-0003Wj-Bb for help-gnu-emacs@gnu.org; Fri, 09 Aug 2024 12:51:43 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1scSq5-0004dx-68; Fri, 09 Aug 2024 12:51:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.com; s=s31663417; t=1723222292; x=1723827092; i=dimech@gmx.com; bh=1bheOXi9YzHe9TTi4IBHaOxeDQpiXEflOeyS9z4+n8Q=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Cc:Subject: Content-Type:Date:In-Reply-To:References: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=UQfXY4fYROud7SKVvVSd2wiQyyjZ35G6FlcaZ3pVrL8dtQeF99jcJ/nO4zSY8iqI u/OMiX1RZSSHxslC7KDLAHDglP8C7jCTmV9ZCQNpXRufhANF2HYZxKA8ptAGTV/Il gCjteoACPzjH3jWYIez54z8U41RWbRKGmZUP6EgRCebpRPcS9s4VnUDTfzGklve+C yQngTqv6tWvACRM8m2hVyGCM4ihLxZ62X+7rWAil5+tMZKmH7JcW1tZnIx5BmWzbn sAenXGAmjIWYDYQtEruDDCOfaWn56FH5ebNBnHC4xIKfn95JXDNLKCR2NQk3jM8j4 ch2JPYvaxRLA9u0XGQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [92.251.79.197] ([92.251.79.197]) by web-mail.gmx.net (3c-app-mailcom-bs09.server.lan [172.19.170.177]) (via HTTP); Fri, 9 Aug 2024 18:51:32 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:c9lxWXZqIakenKBke7K1eO+i484C5qbiWSmgdmJpgBZvxWfQEyEM+unZqScbPE1a5gvck Q/xf0Xf+4yozv9ApQrQEWGD/tmtFSFSiBsCaC+6I5S6VtJIRjjArXH2geCC1eTRJ4E4wCDRGJ4xk UJleSWm1Tyao+8vNNBecl2PQtwa/4M039/RNjXjYd4WcfdJ/uKdIKAjMMuZbX9laZbR3VZ1JimIQ j4wjnB+ROlbb4PduNNEmfEcapAgJHkwzw866q3VMb46NdazrLV3gPBFxw16ymAj3kQkrsHnfjg9L rc= UI-OutboundReport: notjunk:1;M01:P0:t8RC8Zdl7+Y=;of0hWglVi9AGfJaRvj0lxkboD4s 7M4F32pJ2Vg56CkreoVuDunFRRKxvCnivGQbKILyuseHUI5uZ2VtqEsObB8ftDVj/6CIwtk4P 6Bk9rQVWyAUDn8xnYkazgVPpcMJdmY09XRY08jaTsdFmHT5hesdPBK8jU9wu/6bsdloU8VPej 8DHwSE6nQxhkB+4oqVsLZRS6FRuGbJd+sVDWsi2LrE3Fw4CvEP/rjibT2ohTKuiSk+yuBELJN Mk+Z+rYjhIcgzdFoK4cMVMTgp5ugyOG7FcaDQOoVQvwfx4TMs0KK7D8vEMDwJ0UbFifVG5Jad afYNrHoFBWIInmRlWlRYOIO6uvWov3gooTpr0ZwXfQ3iTNKu18gWjKyOWYiJrPRQzggIr1dQr 7wChaXBf7tJhHgkzCSXpdrp+cGO/bKHlsSTAcGTh4T1V+fQx/kcoVG813YOs6kRMNjKUFK/v8 lH939PAHkelL5XI7uugNgCm7EbCKWJ/8FqNA2WpOLm537ImSRmlC12tvQdtFBynbzWbbXAltU zKxXv/Xq4B0MGWIMUEebKW+HiM2ubr73SJnqgQIjvIRIaSCCjrRwW/SDr6egJ2oXAZ5XtnLxQ 0DvXWxvjjrT+pt5oeYtqHC+B9K3JnJm5ZXtQMUmD8kU0NSTezmTt0ecioUeWva+KRl7BeRdqh KvVEU3w99rLjkI2CMCxjhfe/LbF+Ak8fzpK3MKfgPA== Received-SPF: pass client-ip=212.227.15.15; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147574 Archived-At: > Sent: Saturday, August 10, 2024 at 4:19 AM > From: "Drew Adams" > To: "Eli Zaretskii" , "help-gnu-emacs@gnu=2Eorg" > Subject: RE: [External] : Re: Locating file via load-path > > > > > Why cl-pushnew ? > > > > > > Either is OK=2E The doc of `add-to-list' says: > > > > > > you are usually better off using `push' or `cl-pushnew'=2E > >=20 > > Talk about citation out of context=2E The full quotation is > >=20 > > This is handy to add some elements to configuration variables, > > but please do not abuse it in Elisp code, where you are usually > > better off using =E2=80=98push=E2=80=99 or =E2=80=98cl-pushnew=E2=80= =99=2E > >=20 > > IOW, don't (ab)use add-to-list if all you need is to add a new element > > to some list of elements=2E add-to-list is for adding path elements t= o > > variables like load-path=2E >=20 > That text says use it mainly for user ("configuration") > variables, not generally for Lisp code=2E And it neither > says nor suggests anything about lists of path elements=2E >=20 > > > It doesn't say why, and neither does the Elisp manual=2E > >=20 > > Oh, yes, it does, see above=2E >=20 > No, there's nothing about "why" above=2E >=20 > May I humbly encourage you to review the following > mails in this very list from Stefan Monnier on the > subject, back in 2013, during his tenure as the > Emacs maintainer (thread "Is add-to-list supposed > to work when lexical-binding is t?"): In such case add-to-list has to the potential for misleading code=2E There=E2=80=99s an argument to be made that functions like add-to-list=20 should be robust enough to handle a variety of scenarios, not just for modifying configuration variables like load-path=2E There should=20 be some robustness expectations rather than expecting users not to=20 abuse it=2E The function should be versatile and resistant to misuse=2E If developers could use more appropriate list operations when dealing=20 with general-purpose list manipulation (including for load-path), the better life would be for everybody=2E=20 > Not in chronological order, but perhaps in order of > relevance and understanding for us, here: >=20 > https://mail=2Egnu=2Eorg/archive/html/help-gnu-emacs/2013-06/msg00096=2E= html >=20 > https://mail=2Egnu=2Eorg/archive/html/help-gnu-emacs/2013-06/msg00064=2E= html >=20 > https://mail=2Egnu=2Eorg/archive/html/help-gnu-emacs/2013-06/msg00124=2E= html >=20 > https://mail=2Egnu=2Eorg/archive/html/help-gnu-emacs/2013-06/msg00188=2E= html >=20 > In particular, this bit summarizes _WHY_ he added that > "usually better off using =E2=80=98push=E2=80=99 or =E2=80=98cl-pushnew= =E2=80=99" [in > Lisp code] text to the doc string (in Emacs 24): >=20 > "The warning was added because add-to-list is a > frequent use-case where Elisp code presumes > dynamic binding=2E" >=20 > And: >=20 > > Unless you're knee-deep in the internals of the language, > > the difference between `cl-pushnew' and `add-to-list' is > > so obscure as to be incomprehensible=2E >=20 > "Agreed=2E I never liked add-to-list, and now I really > know why =2E=2E=2E other than by ad-hoc handling the case > where the first arg is passed via quoting, the > byte-compiler" [is pretty hopeless for add-to-list] >=20 >