From: Joe Wreschnig Date: Mon, 7 Aug 2017 08:53:25 +0000 (+0200) Subject: Use `locate-dominating-file’ rather than reimplementing it. X-Git-Tag: v20170807~13 X-Git-Url: https://git.korewanetadesu.com/?p=pelican-mode.git;a=commitdiff_plain;h=2fd809219972559a0defeef38aec14a772e88649 Use `locate-dominating-file’ rather than reimplementing it. --- diff --git a/pelican-mode.el b/pelican-mode.el index 6dceba5..47153f8 100644 --- a/pelican-mode.el +++ b/pelican-mode.el @@ -207,19 +207,9 @@ the unquoted printed representation of it is used: (when-let (file-name (file-name-sans-extension buffer-file-name)) (file-name-base file-name)))) -(defun pelican-mode-find-in-parents (file-name) - "Find FILE-NAME in the default directory or one of its parents, or nil." - (let* ((parent (expand-file-name default-directory))) - (while (and (not (file-readable-p (concat parent file-name))) - (not (string= parent (directory-file-name parent)))) - (setq parent (file-name-directory (directory-file-name parent)))) - (let ((found (concat parent file-name))) - (if (file-readable-p found) found nil)))) - (defun pelican-mode-find-root () "Return the root of the buffer's Pelican site, or nil." - (when-let (conf (pelican-mode-find-in-parents "pelicanconf.py")) - (file-name-directory conf))) + (locate-dominating-file default-directory "pelicanconf.py")) (defun pelican-make (target) "Execute TARGET in a Makefile at the root of the site."