knpatel401 / filetree

filetree is an emacs package for displaying and operating on a file list as a file tree, and for maintaining individual notes for files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to make filetree-info / notes relative to a basefolder?

gizmomogwai opened this issue · comments

I really like the package and would like to make the file-notes feature relative to a project.
In the best case a project could have a global filetree-notes.org file in its root and all filenames/folders would be relative to that root.
That way one could easily share project specific notes on files.

@gizmomogwai thanks a lot for the comment and suggestion--I appreciate the feedback.

Ideally, I'd like to keep the notes file centralized, in part because it makes thing simpler, but more importantly, because I'd like to add features going forward that allow searching and filtering notes across projects/files.

That said, I'd like to understand the use case you have in mind a bit more clearly to see if it's something that we can support within the current centralized notes architecture. Currently, we show the notes org-mode file in the side buffer, with the org-mode file narrowed to the note for a particular file. Is the idea that you would want the option to be able to see the notes for all the files in the project in the side buffer (e.g., by widening to the whole project specific notes file)? I may be able to mimic this behavior by generating a sparse org-tree from the notes file that shows notes for files under the project root directory in the side buffer.

@gizmomogwai, sorry, on rereading your suggestion, I think I had misunderstood your use case earlier. If I'm understanding correctly now, you'd like to be able to, for example, easily share all the notes for a project with someone else. I agree that the current centralized notes file doesn't make this convenient to do.

I'll work on adding this functionality. What I can do is search for a "filetree-notes.org" file in the local directory structure, and if one exists in an ancestor directory, then we would use that otherwise we would default to the centralized file.

Hi @knpatel401 , sorry for not explaining better.
The use case would be something like that. One works in a big project (e.g. the linux kernel) and would like to collect notes on it. Ideally the filetree-notes.org file could be configured with a dir-local variable (that gets activated when changing to the kernel project). The 2nd problem is the absolute links in the org file that point to the files. Because different people would have the linux kernel checked out into different folders (and the home folder is also different for every user).

Hi @gizmomogwai , just FYI, I pushed support for project-level/relative note files to the dev branch. I plan to merge it to the master branch if I don't see any issues over the next week or so. If you happen to try it and see any issues please let me know.

In order to use the feature, you should just need to create an empty file in your project directory with the name "filetree-notes-local.org" (the name is customizable under the variable filetree-relative-notes-filename). Any file in the directory tree under this project directory should then automatically use this notes file. Files without any "local" notes file in their hierarchy will use the usual notes file pointed to by filetree-notes-file. Within the relative notes files, the file links should be relative, while the links in the main/global notes files will be absolute.

BTW, for now, we don't support this feature for remote files (accessed via tramp), so for remote files we always use the main/global notes file pointed to by filetree-notes-file.

Feature in f7dd8a3

Thanks for this changes ... I will try them as soon as I am back from vacation.
You could use (locate-dominating-file FILE NAME) from files.el to find the local file if you would like ...

Thanks and thanks for the pointer on locate-dominating-file.