1

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?

2
  • Can you elaborate? For example, just what directory-walking are you referring to in find-file?
    – Drew
    May 11 '18 at 17:54
  • In my observation, many of these special handlings don't take place in find-file-literally. E.g. git repos is not detected, auto-mode-alist does not take effect etc. Does find-file-literally not work for you ?
    – Jeeves
    Sep 9 '18 at 4:38
1

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.
17
  • 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"
    – rjs
    May 12 '18 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)
    – rjs
    May 12 '18 at 19:46
  • the path should read "...edu/common/home/" which is what I'm using in my attempts
    – rjs
    May 12 '18 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?
    – rjs
    May 13 '18 at 3:13
  • 1
    For 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.
    – rjs
    Sep 10 '18 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.