Mercurial > emacs
changeset 95186:edfe642dc91c
(locate-dominating-file): Accept non-existing argument.
(project-find-settings-file): Rewrite, using locate-dominating-file.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 22 May 2008 03:09:34 +0000 |
parents | 6e856c64038f |
children | ee32b9c9936c |
files | lisp/ChangeLog lisp/files.el |
diffstat | 2 files changed, 25 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu May 22 02:34:30 2008 +0000 +++ b/lisp/ChangeLog Thu May 22 03:09:34 2008 +0000 @@ -1,15 +1,18 @@ +2008-05-22 Stefan Monnier <monnier@iro.umontreal.ca> + + * files.el (locate-dominating-file): Accept non-existing argument. + (project-find-settings-file): Rewrite, using locate-dominating-file. + 2008-05-22 Kenichi Handa <handa@m17n.org> - * faces.el (font-weight-table, font-slant-table) - (font-width-table): Delete them. Don't call - internal-set-font-style-table. + * faces.el (font-weight-table, font-slant-table, font-width-table): + Delete them. Don't call internal-set-font-style-table. * international/mule-diag.el (font-show-log): New function. * international/fontset.el (script-representative-chars): Add more chars for latin. Add data for symbol. - (setup-default-fontset): Add entries for phonetic, armenian, and - symbol. + (setup-default-fontset): Add entries for phonetic, armenian, and symbol. 2008-05-21 Stefan Monnier <monnier@iro.umontreal.ca>
--- a/lisp/files.el Thu May 22 02:34:30 2008 +0000 +++ b/lisp/files.el Thu May 22 03:09:34 2008 +0000 @@ -746,7 +746,8 @@ (let ((prev-user user)) (setq user (nth 2 (file-attributes file))) (or (null prev-user) (equal user prev-user)))) - (if (setq files (directory-files dir 'full regexp)) + (if (setq files (and (file-directory-p dir) + (directory-files dir 'full regexp))) (throw 'found (car files)) (if (equal dir (setq dir (file-name-directory @@ -3119,19 +3120,21 @@ If the file is in a registered project, a cons from `project-directory-alist' is returned. Otherwise this returns nil." - (let ((dir (file-name-directory file)) - (result nil)) - (while (and (not (string= dir "/")) - (not result)) - (cond - ((setq result (assoc dir project-directory-alist)) - ;; Nothing else. - nil) - ((file-exists-p (expand-file-name ".dir-settings.el" dir)) - (setq result (expand-file-name ".dir-settings.el" dir))) - (t - (setq dir (file-name-directory (directory-file-name dir)))))) - result)) + (setq file (expand-file-name file)) + (let* ((settings (locate-dominating-file file "\\`\\.dir-settings\\.el\\'")) + (pda nil)) + ;; `locate-dominating-file' may have abbreviated the name. + (if settings (setq settings (expand-file-name settings))) + (dolist (x project-directory-alist) + (when (and (eq t (compare-strings file nil (length (car x)) + (car x) nil nil)) + (> (length (car x)) (length (car pda)))) + (setq pda x))) + (if (and settings pda) + (if (> (length (file-name-directory settings)) + (length (car pda))) + settings pda) + (or settings pda)))) (defun project-define-from-project-file (settings-file) "Load a settings file and register a new project class and instance.