Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
418fd375
Commit
418fd375
authored
Jul 19, 2007
by
Stefan Monnier
Browse files
(locate-dominating-file): New function.
parent
6e3aa3f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/files.el
lisp/files.el
+18
-0
No files found.
lisp/ChangeLog
View file @
418fd375
2007-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
* files.el (locate-dominating-file): New function.
2007-07-18 Michael Albinus <michael.albinus@gmx.de>
* progmodes/grep.el (grep-host-defaults-alist): New defvar.
...
...
@@ -13,6 +17,7 @@
files. Change two keybindings to point to new function names.
2007-07-18 Juanma Barranquero <lekktu@gmail.com>
* follow.el (follow-mode-hook, follow-mode-off-hook, follow-mode)
(follow-delete-other-windows-and-split, follow-recenter)
(follow-windows-aligned-p, follow-point-visible-all-windows-p)
...
...
lisp/files.el
View file @
418fd375
...
...
@@ -711,6 +711,24 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
((
null
action
)
(
try-completion
string
names
))
(
t
(
test-completion
string
names
))))))
(
defun
locate-dominating-file
(
file
regexp
)
"Look up the directory hierarchy from FILE for a file matching REGEXP."
(
while
(
and
file
(
not
(
file-directory-p
file
)))
(
setq
file
(
file-name-directory
(
directory-file-name
file
))))
(
catch
'found
(
let
((
user
(
nth
2
(
file-attributes
file
)))
;; Abbreviate, so as to stop when we cross ~/.
(
dir
(
abbreviate-file-name
(
file-name-as-directory
file
)))
files
)
(
while
(
and
dir
(
equal
user
(
nth
2
(
file-attributes
dir
))))
(
if
(
setq
files
(
directory-files
dir
'full
regexp
))
(
throw
'found
(
car
files
))
(
if
(
equal
dir
(
setq
dir
(
file-name-directory
(
directory-file-name
dir
))))
(
setq
dir
nil
))))
nil
)))
(
defun
executable-find
(
command
)
"Search for COMMAND in `exec-path' and return the absolute file name.
Return nil if COMMAND is not found anywhere in `exec-path'."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment