As Emacs opens a file it does all sorts of useful things including walking up the directory tree for more information (repos etc). I'm in a situation where I need to curtail that climb. Is there a mechanism for this or other work around?
1 Answer
There's locate-dominating-stop-dir-regexp
:
Regexp of directory names which stop the search in ‘locate-dominating-file’.
Any directory whose name matches this regexp will be treated like
a kind of root directory by ‘locate-dominating-file’ which will stop its search
when it bumps into it.
The default regexp prevents fruitless and time-consuming attempts to find
special files in directories in which filenames are interpreted as hostnames,
or mount points potentially requiring authentication as a different user.
-
By no means am I a regex pro but I can't even get a near-static value to stop the directory search.(custom-set-variables '(locate-dominating-stop-dir-regexp "\`/uufs/chpc\\.utah\\.edu/home/camp-group1\\'")) does not work (nor does adding a forward slash after "group1"– rjsCommented May 12, 2018 at 15:50
-
As emacs walks up the dir stack looking for multiple possible version control systems etc I get a three second delay (strace) for each as it crosses an automount point at /uufs/chpc.utah.edu/home. I suppose I could remove the list of things to look for (I'm only using one vcs) but that would still leave one 3 second delay at least. (Much better than the 20-30 sec. currently)– rjsCommented May 12, 2018 at 19:46
-
the path should read "...edu/common/home/" which is what I'm using in my attempts– rjsCommented May 12, 2018 at 19:57
-
I have tested my expression (using the same test seen in locate-dominating-file) and it returns true (non-nil) when the directory is ONLY my intended stopper and nil otherwise, so I'm starting to doubt that this mechanism is used under find-file. Any other suggestions?– rjsCommented May 13, 2018 at 3:13
-
1For completeness, I submitted a bug against "vc-ignore-dir-regexp" which resets the default value of locate-dominating-file-regexp, over-writing what ever one assigns.– rjsCommented Sep 10, 2018 at 20:17
find-file
?