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?

  • Can you elaborate? For example, just what directory-walking are you referring to in find-file? – Drew May 11 at 17:54

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.
  • This looks promising. Thank you. – rjs May 11 at 19:35
  • 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 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 at 19:46
  • the path should read "...edu/common/home/" which is what I'm using in my attempts – rjs May 12 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 at 3:13

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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