emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/markdown-mode a43629d 2/3: Don't use project.el function i


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode a43629d 2/3: Don't use project.el function if here is under VCS
Date: Tue, 2 Feb 2021 23:57:09 -0500 (EST)

branch: elpa/markdown-mode
commit a43629de40811c84d50b3df5baa0fb09e0e4f3bd
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>

    Don't use project.el function if here is under VCS
---
 markdown-mode.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/markdown-mode.el b/markdown-mode.el
index 91e982b..e0eec96 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -7859,6 +7859,14 @@ The location of the alias component depends on the value 
of
       (push 'parent-directories ret))
     ret))
 
+(defun markdown--project-root ()
+  (or (cl-loop for dir in '(".git" ".hg" ".svn")
+               when (locate-dominating-file default-directory dir)
+               return it)
+      (progn
+        (require 'project)
+        (car (project-roots (project-current t))))))
+
 (defun markdown-convert-wiki-link-to-filename (name)
   "Generate a filename from the wiki link NAME.
 Spaces in NAME are replaced with `markdown-link-space-sub-char'.
@@ -7899,11 +7907,9 @@ in parent directories if
              (setq dir (locate-dominating-file directory default)))
         (concat dir default))
        ((and (memq 'project search-types)
-             (progn
-               (require 'project)
-               (let ((roots (project-roots (project-current t))))
-                 (setq candidates
-                       (directory-files-recursively (car roots) (concat "^" 
default "$"))))))
+             (setq candidates
+                   (directory-files-recursively
+                    (markdown--project-root) (concat "^" default "$"))))
         (car candidates))
        ;; If nothing is found, return default in current directory.
        (t default)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]