GNU bug report logs -
#63829
29.0.90; project-find-file's future history breaks with common-parent-directory
Previous Next
Full log
View this message in rfc822 format
On 15/08/2023 01:47, sbaugh <at> catern.com wrote:
>>>> I'm not sure I understand the alternative - the idea would be to share
>>>> project file name history between all projects? I guess that could be
>>>> nice, although I don't personally use file name history that much, and
>>>> AFAIK it wouldn't solve any concrete user problems, so I'm not really
>>>> motivated to implement it.
>>>
>>> The alternative is a little more general, e.g. propertize every such
>>> history entry with the value of the root, so that they can be
>>> post-processed to adapt to any other root directory.
>>>
>>> This shouldn't take too much work, actually. But I don't know if that
>>> is indeed a necessary feature. From the discussion
>>> (https://debbugs.gnu.org/58447), I had been under impression that it
>>> would be wanted, but it might be just "nice to have".
>>
>> I would be happy to do that. That sounds very cool actually.
>>
>> Can you elaborate on how exactly you imagine this happening? I guess,
>> every time someone enters a filename with project-find-file or
>> project-find-dir, we would include a propertized version of that
>> filename in file-name-history? And then we would re-relativize them and
>> adapt them to the current project when including them as history?
>
> Okay, I did that. Extremely rough patch follows.
Thanks! It's very close to what I was thinking of (modulo some cosmetics
and perf optimizations).
> Btw, the reason I'm interested in this shared project history is because
> our workflow involves creating many new projects (one per branch); so
> mostly each project has no history at all, and sharing history between
> projects is the only way to get any.
Now that you can have this additional capability as an option, do you
think you will be using it as well?
> But, it seems to me that this doesn't really help with having the
> current file be "future history". That's still useful when switching
> between similar projects. And all the logic of my other patch which
> does that, is still required with this patch.
Indeed, that's a good point. So I think we'll install your first patch
either way.
Before we do that, small (or not so small) question: do you think we
should test that the current buffer exists in the other project too? We
could do that with file-exists-p (but that's an extra round-trip over
Tramp), or by checking against the full list like in below.
Relatedly, with the cross-project history, we should ask the same
question: will we check that the "transplanted" history entries
correspond to existing files in the other project (and filter out those
that don't).
WDYT?
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d8b12c9c880..a32bc2dd8d3 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1116,7 +1116,10 @@ project-find-file-in
(completion-ignore-case read-file-name-completion-ignore-case)
(file (funcall project-read-file-name-function
"Find file" all-files nil 'file-name-history
- suggested-filename)))
+ (if (file-name-absolute-p suggested-filename)
+ (and (member suggested-filename all-files)
+ suggested-filename)
+ suggested-filename))))
(if (string= file "")
(user-error "You didn't specify the file")
(find-file file))))
This bug report was last modified 1 year and 297 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.