From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#58447: [PATCH] In project-find-file, add absolute file name to history Date: Tue, 11 Oct 2022 20:29:24 +0200 Message-ID: <8735budxiz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13373"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 58447@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 11 20:40:02 2022 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 1oiKAb-0003Gd-3k for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Oct 2022 20:40:01 +0200 Original-Received: from localhost ([::1]:40188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiKAZ-0005CR-Lx for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Oct 2022 14:39:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiK0x-0005Sy-B8 for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 14:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiK0w-00059j-Qo for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 14:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiK0w-0004r0-Kt for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 14:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Oct 2022 18:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58447 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166551298918615 (code B ref -1); Tue, 11 Oct 2022 18:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Oct 2022 18:29:49 +0000 Original-Received: from localhost ([127.0.0.1]:54796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiK0i-0004qB-Ke for submit@debbugs.gnu.org; Tue, 11 Oct 2022 14:29:48 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiK0f-0004q2-Kv for submit@debbugs.gnu.org; Tue, 11 Oct 2022 14:29:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiK0R-0005BF-CA for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 14:29:40 -0400 Original-Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:36652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiK0P-000552-Rp for bug-gnu-emacs@gnu.org; Tue, 11 Oct 2022 14:29:31 -0400 Original-Received: by mail-ej1-x632.google.com with SMTP id 13so33307437ejn.3 for ; Tue, 11 Oct 2022 11:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=8CF3Qpw0y07FblKEVQpf/qHoW+TwUMtsMLtLNkTPJ9w=; b=JM4tf1VufkzH28Hb4thMNGJbu9aRoXYsZszaMcEXfnBp6ri4+qAB/isO3+/519yOET iDEr+NaxZuD/zg1d/OohroJdHoYGnTqczs0cghYlGKNFK9iQZIIcqOE/I5bNDwX3R82R AZsNTGuKrOQn5I6yJROgR1n27k+Yj+60sQ7DSgGXXfs1zuHZqiD9FfLT61AUDw6LG0Ki XJIeYuergQ2ywmS+qHfULpObP0+kRiLUuVqY9XGp8owE+H7usX0KCLW9WZdnrYsEdh6K gLSHKqUnRCTOlp8ZJG4RRmxLINIP8exqSmOmeTg99SwNlOqmXSMlpgeUu8NrNFA4d60N CXsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8CF3Qpw0y07FblKEVQpf/qHoW+TwUMtsMLtLNkTPJ9w=; b=sfdNU3qmvgpCJGVfR7HNXfs48GGSaNKnBD86NVSG2bN9qWQKExpVVDxdOzWj4Uw8S8 ovuWhUfHmxKxV2dMDbRes/LSxerIyPHjcuSVftFAOd4LFhwtUsmCPPbIlfy9/+56sqzB nRHSOLG6R9vBslM15jpA0tjj/Uvc23VjFAOB9pQQAF8RI+hMqhMSlDIYhKnzwSbvm7Bs V358w8m6IYWXFNZntgET2ezuqk6Dn9DFA0O8n3BoxATwe27XKx/RrseZKBbIj75uJi14 UbcTJ8Bu6q05+tswESqRqJTMQEu7MSXO91LUWJzTZSvL/kzroQJQSZJLwRY/nYGYZ4k5 phTQ== X-Gm-Message-State: ACrzQf1ZW7htw/pO25AevDJckX1wky3i7tCkJHgKNA/1x7xb4G4skahB Wi+WH+Ptbcx9wxNcTguiEW107Yu8Ycw= X-Google-Smtp-Source: AMsMyM6nRa0swhVOhD1RaHO5Od1/epkZUzvPteE8JFCUm2B2KvToxVtDx/mq5VVeMhq77vsgCn8RTQ== X-Received: by 2002:a17:907:2daa:b0:78d:4dca:43e with SMTP id gt42-20020a1709072daa00b0078d4dca043emr19941908ejc.134.1665512966351; Tue, 11 Oct 2022 11:29:26 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::89aa]) by smtp.gmail.com with ESMTPSA id dy4-20020a05640231e400b00457618d3409sm9491797edb.68.2022.10.11.11.29.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:29:25 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=arstoffel@gmail.com; helo=mail-ej1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Xref: news.gmane.io gmane.emacs.bugs:245127 Archived-At: --=-=-= Content-Type: text/plain Tags: patch `project-find-file' and related commands share their history with more general commands like `find-file', so they should add the absolute file name to history. Currently, file names relative to the project root are added. The attached patch fixes this. I've also replaced `concat' with `expand-file-name' at a certain point. I see no reason why one shouldn't do that, but please have a look. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-In-project-find-file-and-the-like-add-absolute-file-.patch >From 699732687f559c7984e76310971094f251423d5d Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Tue, 11 Oct 2022 20:21:34 +0200 Subject: [PATCH] In project-find-file and the like, add absolute file name to history * lisp/progmodes/project.el (project--read-file-cpd-relative): Add absolute file name to history. --- lisp/progmodes/project.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ee94d0d85d..95087ae6a8 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -931,11 +931,15 @@ project--read-file-cpd-relative (_ (when included-cpd (setq substrings (cons "./" substrings)))) (new-collection (project--file-completion-table substrings)) - (res (project--completing-read-strict prompt - new-collection - predicate - hist mb-default))) - (concat common-parent-directory res))) + (relname (let ((history-add-new-input nil)) + (project--completing-read-strict prompt + new-collection + predicate + hist mb-default))) + (absname (expand-file-name relname common-parent-directory))) + (when (and hist history-add-new-input) + (add-to-history hist absname)) + absname)) (defun project--read-file-absolute (prompt all-files &optional predicate -- 2.37.3 --=-=-=--