aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorPaul Eggert2016-04-11 09:07:16 -0700
committerPaul Eggert2016-04-11 09:07:16 -0700
commitd1e2b10afa2df313e029b3faeeb0d694fd6e0fbc (patch)
tree8584e88dc40f4617ead97664b3732d041c21982d /lisp/progmodes
parent7b45cc583c4f16cc070a9925431ca944f510a685 (diff)
parent96d9e78bd40edff9c901eee1c95ea56d93b55acb (diff)
downloademacs-d1e2b10afa2df313e029b3faeeb0d694fd6e0fbc.tar.gz
emacs-d1e2b10afa2df313e029b3faeeb0d694fd6e0fbc.zip
Merge from origin/emacs-25
96d9e78 Fix "Beginning of buffer" error in forward-page 20686f7 Add a `transient' project type
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/project.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1251bca2491..9c8a88c80fc 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -101,7 +101,9 @@ that it is not applicable, or a project instance.")
101(defun project-current (&optional maybe-prompt dir) 101(defun project-current (&optional maybe-prompt dir)
102 "Return the project instance in DIR or `default-directory'. 102 "Return the project instance in DIR or `default-directory'.
103When no project found in DIR, and MAYBE-PROMPT is non-nil, ask 103When no project found in DIR, and MAYBE-PROMPT is non-nil, ask
104the user for a different directory to look in." 104the user for a different directory to look in. If that directory
105is not a part of a detectable project either, return a
106`transient' project instance rooted in it."
105 (unless dir (setq dir default-directory)) 107 (unless dir (setq dir default-directory))
106 (let ((pr (project--find-in-directory dir))) 108 (let ((pr (project--find-in-directory dir)))
107 (cond 109 (cond
@@ -110,7 +112,8 @@ the user for a different directory to look in."
110 (setq dir (read-directory-name "Choose the project directory: " dir nil t) 112 (setq dir (read-directory-name "Choose the project directory: " dir nil t)
111 pr (project--find-in-directory dir)) 113 pr (project--find-in-directory dir))
112 (unless pr 114 (unless pr
113 (user-error "No project found in `%s'" dir)))) 115 (message "Using '%s' as a transient project root" dir)
116 (setq pr (cons 'transient dir)))))
114 pr)) 117 pr))
115 118
116(defun project--find-in-directory (dir) 119(defun project--find-in-directory (dir)
@@ -182,6 +185,9 @@ to find the list of ignores for each directory."
182 (t 185 (t
183 (complete-with-action action all-files string pred)))))) 186 (complete-with-action action all-files string pred))))))
184 187
188(cl-defmethod project-roots ((project (head transient)))
189 (list (cdr project)))
190
185(defgroup project-vc nil 191(defgroup project-vc nil
186 "Project implementation using the VC package." 192 "Project implementation using the VC package."
187 :version "25.1" 193 :version "25.1"