From 2fd809219972559a0defeef38aec14a772e88649 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Mon, 7 Aug 2017 10:53:25 +0200 Subject: [PATCH] =?utf8?q?Use=20`locate-dominating-file=E2=80=99=20rather?= =?utf8?q?=20than=20reimplementing=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- pelican-mode.el | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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." -- 2.20.1