From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#67310: [PATCH] Include the project--list as history when prompting for a project Date: Sat, 25 Nov 2023 16:05:03 +0200 Message-ID: <96636783-62bb-0bb1-ecb5-c510630402e3@gutov.dev> References: <421e3ea8-d150-566e-f645-cbf1ccbcba61@gutov.dev> <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@gutov.dev> <5c3eb6a1-38da-8af4-419a-e0567b163e3a@gutov.dev> <83bkblgeja.fsf@gnu.org> <83edgedy1j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13938"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: 67310@debbugs.gnu.org, sbaugh@janestreet.com, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 25 15:06:19 2023 Return-path: Envelope-to: geb-bug-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 1r6tIX-0003OT-Ov for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Nov 2023 15:06:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6tIE-0006sZ-N9; Sat, 25 Nov 2023 09:05:58 -0500 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 1r6tID-0006rV-Bu for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 09:05:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r6tID-0000on-3T for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 09:05:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r6tIH-0000Wm-Ua for bug-gnu-emacs@gnu.org; Sat, 25 Nov 2023 09:06:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Nov 2023 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67310 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67310-submit@debbugs.gnu.org id=B67310.17009211221961 (code B ref 67310); Sat, 25 Nov 2023 14:06:01 +0000 Original-Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 14:05:22 +0000 Original-Received: from localhost ([127.0.0.1]:38209 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6tHd-0000VY-Ks for submit@debbugs.gnu.org; Sat, 25 Nov 2023 09:05:22 -0500 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:49321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6tHb-0000VJ-9k for 67310@debbugs.gnu.org; Sat, 25 Nov 2023 09:05:20 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C8F0832009F4; Sat, 25 Nov 2023 09:05:07 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sat, 25 Nov 2023 09:05:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700921107; x=1701007507; bh=W5oPZ6BcPVEAyBSLluQMCq6PHvbqr2GJol4 ofnKS2R0=; b=KsM+LjFSvZ67+W0AcYSXsJCC35CQxOYwXFX6lJdPR2+pKoNS/+/ 1wHWhUBnbiIMtHRgicha0qD5aWuRKVkZWQQZOY97Jz7+IPtRwufXVMCfpwU3bC/V JO/r+bEZpAXWDzK/CzE70IbjRbg3YovaJtxCNIfqKyuQgx7xWV8TCrTpiR3S6iqs nwrwnWoB+6meHSJUs+VI5+ZQUlePUoUkMaPOsrpSr9BYaZzIxYEiWZQxovxSN/GY nGD543U2fUp9Q2tesE9m2001RoLqeLE/pbgTqboGt2Vu9PFxhAN+gKEXHKdLeM7l sDGt0cmjEN7E1TvTF6vGYWkB5ZihxmCm4Vw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700921107; x=1701007507; bh=W5oPZ6BcPVEAyBSLluQMCq6PHvbqr2GJol4 ofnKS2R0=; b=fguHcxR0ucUSKBN/mlzOBa1zaSxEycjWQTBhcPqJKiqQzpaUDAU qhSWvui1ZBWn6joIAWgSk7m3zFQBzWQLSHOTc5JsTgTakByT3u4tbu7uavy4SD4W xeCniIUKTXMkFDILplr1yFq51UVHp7R9IdPpTjdmEQLf8uBUjbUrI7pl726GtYYr RzxcmxWLfCOVhIw6cSDwc6pAfXed8WMbUub8lWGwpzgqjofL2kSvd6yaR1oI4TM9 qiF6OQo7JF6olS69LbffoXlzQsaRbGnjhEm36LquPWRHFJ7MnGWOD2gq/mdONPd0 Y+JQTLI3qMGue81qwpLaEabVPlM+b93yjvw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehjedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Nov 2023 09:05:05 -0500 (EST) Content-Language: en-US In-Reply-To: <83edgedy1j.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274978 Archived-At: On 25/11/2023 10:42, Eli Zaretskii wrote: >> Date: Sat, 25 Nov 2023 03:54:13 +0200 >> Cc: 67310@debbugs.gnu.org, juri@linkov.net >> From: Dmitry Gutov >> >> I'll try to answer some of the questions that are still relevant to the >> latest patch, myself. >> >> On 23/11/2023 08:38, Eli Zaretskii wrote: >> >>>> + ;; Iterate in reverse order so project--name-history is in >>>> + ;; the correct order. >>> >>> What is the "correct" order? >> >> Their order in project--list. >> >> Iteration and construction of a new list with 'push' leads to the >> reverse order, hence the use of reversion at the beginning to counteract >> that. > > Then the comment should say > > Iterate in reverse order so project--name-history is in the same > order as project--list. Sure. >>>> - (if-let (proj (project--find-in-directory dir)) >>>> - (push (cons (project-name proj) proj) ret))) >>>> + (when-let (proj (project--find-in-directory dir)) >>>> + (let ((name (project-name proj))) >>>> + (push name project--name-history) >>>> + (push (cons name proj) ret)))) >>> >>> Not sure I understand why you replaced if-let with when-let here. >> >> To reduce the amount of indentation, perhaps. > > Why is that an advantage? > > I generally request and expect people not to make unnecessary changes, > since doing that makes forensics harder: you see changes which don't > change the code's semantics, and need to waste time studying such > "changes" and deciding that they are no-ops. > > Please everyone keep this in mind when you make changes. In general we don't frown in making minor cosmetic changes in the same area as major meaningful changes are done. Conversely, we do frown on cosmetic changes when nothing else is added. Ergo, the only time to make such minor changes is when more meaningful changes are done. If the latter was not the case, we could instead prefer the more common tactic of separating functional and cosmetic changes. >>>> + (let ((history-delete-duplicates t) >>>> + (history-length t)) >>>> + (add-to-history 'project--list root)) >>> >>> Why are you overriding the values of these two user options? >> >> To implement the current behavior (how additions to project--list) >> happen. I've described that behavior in one of the earlier messages here. > > I think this is not a good idea, regardless of the reasons. Users > have these options to control how history functionality behaves in > Emacs, and here you take away that control with no "fire escape". Actually, never mind: the latest version of the patch doesn't use 'add-to-history', or reference these variables.