all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#58447: [PATCH] In project-find-file, add absolute file name to history
@ 2022-10-11 18:29 Augusto Stoffel
  2022-10-11 19:13 ` Eli Zaretskii
  0 siblings, 1 reply; 64+ messages in thread
From: Augusto Stoffel @ 2022-10-11 18:29 UTC (permalink / raw)
  To: 58447

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-In-project-find-file-and-the-like-add-absolute-file-.patch --]
[-- Type: text/patch, Size: 1724 bytes --]

From 699732687f559c7984e76310971094f251423d5d Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
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


^ permalink raw reply related	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2022-12-19 20:00 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 18:29 bug#58447: [PATCH] In project-find-file, add absolute file name to history Augusto Stoffel
2022-10-11 19:13 ` Eli Zaretskii
2022-10-26  9:04   ` Augusto Stoffel
2022-10-27  8:44     ` Dmitry Gutov
2022-10-27 13:15       ` Eli Zaretskii
2022-10-27 14:21         ` Dmitry Gutov
2022-10-27 14:26           ` Augusto Stoffel
2022-10-27 15:36             ` Dmitry Gutov
2022-10-27 15:56               ` Augusto Stoffel
2022-10-27 16:07                 ` Dmitry Gutov
2022-10-27 15:52           ` Eli Zaretskii
2022-10-27 16:10             ` Dmitry Gutov
2022-10-27 16:37               ` Augusto Stoffel
2022-10-27 16:48                 ` Dmitry Gutov
2022-10-27 16:53                   ` Augusto Stoffel
2022-10-27 17:34                     ` Dmitry Gutov
2022-10-27 17:48                       ` Augusto Stoffel
2022-10-27 18:05                         ` Dmitry Gutov
2022-10-27 18:12                           ` Augusto Stoffel
2022-10-27 19:51                             ` Dmitry Gutov
2022-10-27 19:41                 ` Juri Linkov
2022-10-28 18:11                   ` Dmitry Gutov
2022-10-29 17:45                     ` Juri Linkov
2022-10-30 19:42                       ` Dmitry Gutov
2022-10-31  8:06                         ` Augusto Stoffel
2022-11-01 17:30                           ` Juri Linkov
2022-11-01 22:14                             ` Dmitry Gutov
2022-11-18 16:28                               ` Augusto Stoffel
2022-11-25 13:39                                 ` Eli Zaretskii
2022-11-26  2:28                                 ` Dmitry Gutov
2022-11-28 22:58                                   ` Augusto Stoffel
2022-11-29 16:29                                     ` Dmitry Gutov
2022-12-09  7:38                             ` Juri Linkov
2022-12-09 13:00                               ` Dmitry Gutov
2022-12-10 17:27                                 ` Juri Linkov
2022-12-10 19:50                                   ` Dmitry Gutov
2022-12-11 17:57                                     ` Juri Linkov
2022-12-11 18:14                                       ` Dmitry Gutov
2022-12-12 17:41                                         ` Juri Linkov
2022-12-12 18:49                                           ` Augusto Stoffel
2022-12-13 17:28                                             ` Juri Linkov
2022-12-14 16:47                                               ` Augusto Stoffel
2022-12-14 18:45                                                 ` Dmitry Gutov
2022-12-14 19:32                                                   ` Augusto Stoffel
2022-12-14 23:04                                                     ` Dmitry Gutov
2022-12-15  7:24                                                       ` Juri Linkov
2022-12-15 11:07                                                         ` Augusto Stoffel
2022-12-15 14:04                                                           ` Dmitry Gutov
2022-12-15 13:54                                                         ` Dmitry Gutov
2022-12-15 17:24                                                           ` Juri Linkov
2022-12-15 22:20                                                             ` Dmitry Gutov
2022-12-16  7:48                                                               ` Juri Linkov
2022-12-18  0:32                                                                 ` Dmitry Gutov
2022-12-15 11:07                                                       ` Augusto Stoffel
2022-12-15 14:08                                                         ` Dmitry Gutov
2022-12-15 17:21                                                           ` Juri Linkov
2022-12-15 22:50                                                             ` Dmitry Gutov
2022-12-18  8:36                                                               ` Juri Linkov
2022-12-18 11:51                                                                 ` Dmitry Gutov
2022-12-19 17:55                                                                   ` Juri Linkov
2022-12-19 18:01                                                                     ` Eli Zaretskii
2022-12-19 19:48                                                                       ` Juri Linkov
2022-12-19 20:00                                                                         ` Eli Zaretskii
2022-12-19 19:18                                                                     ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.