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: Thu, 23 Nov 2023 04:55:56 +0200 Message-ID: References: <421e3ea8-d150-566e-f645-cbf1ccbcba61@gutov.dev> <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@gutov.dev> <5c3eb6a1-38da-8af4-419a-e0567b163e3a@gutov.dev> 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="11099"; 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, eliz@gnu.org, juri@linkov.net To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 23 03:57:15 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 1r5ztx-0002gM-Mj for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Nov 2023 03:57:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5ztk-0008Aa-GZ; Wed, 22 Nov 2023 21:57:00 -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 1r5ztj-0008AS-EG for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 21:56:59 -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 1r5ztj-0008QY-5p for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 21:56:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r5ztm-0002XA-DV for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 21:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Nov 2023 02:57:02 +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.17007081739668 (code B ref 67310); Thu, 23 Nov 2023 02:57:02 +0000 Original-Received: (at 67310) by debbugs.gnu.org; 23 Nov 2023 02:56:13 +0000 Original-Received: from localhost ([127.0.0.1]:60295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5zsz-0002Vs-7T for submit@debbugs.gnu.org; Wed, 22 Nov 2023 21:56:13 -0500 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:55615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5zsx-0002Va-LA for 67310@debbugs.gnu.org; Wed, 22 Nov 2023 21:56:12 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E1F6F3200A4A; Wed, 22 Nov 2023 21:56:01 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 22 Nov 2023 21:56:02 -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= 1700708161; x=1700794561; bh=CPJYDjB2B9/XWDj17Zgt0NYu8RKjTY/v6Rt lgjY0VLY=; b=di5z/CVcIjbvVjA4BE0krXl57RhNNmotGwhsQBdgY2s2aV7C0as KIqW0bggLUaBxHktmj2oqTKt+/VvXFQoxAeJF2dd6kn5CqBDPVVx0e7sivACnVvC V2Qa1mQeNpOyH312HCzDlC2m4f0MQvzzlbMS5KpxlDmvefr10bmSzCNZaW/oXhZn QEzYlOmj0oJQKegcDc3CUIi2AfVlG7z7axQ1T7mlz/+LyT5U32Nb1iUKHWwyzhgh ebzWDi7p8/BAbG1DlvvOsPyH69HDjRthKjcmZWzm+pyVxHzhD/dgmHTMZb58cHL9 Nbn/ecyJp73SdXhcNv1tcIuWz1Tklo6Byhg== 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= 1700708161; x=1700794561; bh=CPJYDjB2B9/XWDj17Zgt0NYu8RKjTY/v6Rt lgjY0VLY=; b=0JHUoXzSQIzGmVm4k/S/P7qLPUcupdVCp7KCbAX7mvVWP0V7hv/ aoZSIqOKeYJQXpMhlfXsn50i6YlAQdt8+7qMyThCPbPe+vyd/2pLk/kJfYyYwCJG 0GlQFWD0//jxjupuK7v14V7RSxVHStfC30Jkx3CFE47+vcIBHdqvlbXjPTbFxdXc bEXaIhIlGXPWkMnlf5H3IfT7qEw6YRRLP1j1BrxMVyRK0YcCC9N4zT2N4kvxMwPT gAzbwl/Lju/0LgBh+eeYqN/QSlh52+le8drRxKpFsq1kwHGyL9LUCOGsX9PpdGdy CEetaM0TACTRmV7f4e61pRJrQF5rYKwANgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehvddghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Nov 2023 21:55:59 -0500 (EST) Content-Language: en-US In-Reply-To: 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:274787 Archived-At: On 23/11/2023 01:14, Spencer Baugh wrote: > @@ -1769,27 +1778,40 @@ project-prompt-project-dir > ;; completion style). > (project--file-completion-table > (append project--list `(,dir-choice)))) > + (project--dir-history project--list) > (pr-dir "")) > (while (equal pr-dir "") > ;; If the user simply pressed RET, do this again until they don't. > - (setq pr-dir (completing-read "Select project: " choices nil t))) > + (setq pr-dir > + (let ((history-add-new-input nil)) > + (completing-read "Select project: " choices nil t nil 'project--dir-history)))) > (if (equal pr-dir dir-choice) > (read-directory-name "Select directory: " default-directory nil t) > + (let q((history-delete-duplicates t) ^ typo > + (history-length t)) > + (add-to-history 'project--list pr-dir)) > pr-dir))) Sorry, I thought we agreed that project-prompt-project-dir and project-prompt-project-name shouldn't add-to-history? Because project-current calls project-remember-project already (including the cases when the prompter isn't used: when the project is auto-detected). And to cover the remaining cases, we can have project-switch-project call project-remember-project as well. This way also we keep the project-prompter implementations with less logic inside, meaning it's a bit easier to write the next one. More DRY, too. At least while there's no other code using project-prompter directly (but then we could add a helper).