summaryrefslogtreecommitdiff
path: root/lisp/progmodes/project.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2015-08-02 01:01:28 +0300
committerDmitry Gutov <dgutov@yandex.ru>2015-08-02 01:30:36 +0300
commit543bb9bc2023fafdadf697e23484214daac95dee (patch)
treec0abd684296a63de9e1366d1123575e330c001d6 /lisp/progmodes/project.el
parent08d65696c947b09d4c32606f279c3c2594e99e16 (diff)
downloademacs-543bb9bc2023fafdadf697e23484214daac95dee.tar.gz
emacs-543bb9bc2023fafdadf697e23484214daac95dee.tar.bz2
emacs-543bb9bc2023fafdadf697e23484214daac95dee.zip
Add a second argument to project-ignores
* lisp/progmodes/project.el (project-ignores): Add a second argument DIR. * lisp/progmodes/project.el (project-ignores): Only include the VC ignores if DIR is the VC root. * lisp/progmodes/xref.el (xref-find-regexp): Update accordingly.
Diffstat (limited to 'lisp/progmodes/project.el')
-rw-r--r--lisp/progmodes/project.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 27354598f8d..d849f93b5e8 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -78,10 +78,12 @@ It should include the current project root, as well as the roots
of any other currently open projects, if they're meant to be
edited together. The directory names should be absolute.")
-(cl-defgeneric project-ignores (_project)
- "Return the list of glob patterns that match ignored files.
+(cl-defgeneric project-ignores (_project _dir)
+ "Return the list of glob patterns to ignore inside DIR.
+Patterns can match both regular files and directories.
To root an entry, start it with `./'. To match directories only,
-end it with `/'."
+end it with `/'. DIR must be either one of `project-roots', or
+an element of `project-search-path'."
(require 'grep)
(defvar grep-find-ignored-files)
(nconc
@@ -100,16 +102,18 @@ end it with `/'."
(cl-defmethod project-roots ((project (head vc)))
(list (cdr project)))
-(cl-defmethod project-ignores ((project (head vc)))
+(cl-defmethod project-ignores ((project (head vc)) dir)
(nconc
- (let* ((dir (cdr project))
- (backend (vc-responsible-backend dir)))
- (mapcar
- (lambda (entry)
- (if (string-match "\\`/" entry)
- (replace-match "./" t t entry)
- entry))
- (vc-call-backend backend 'ignore-completion-table dir)))
+ (let* ((root (cdr project))
+ backend)
+ (when (file-equal-p dir root)
+ (setq backend (vc-responsible-backend root))
+ (mapcar
+ (lambda (entry)
+ (if (string-match "\\`/" entry)
+ (replace-match "./" t t entry)
+ entry))
+ (vc-call-backend backend 'ignore-completion-table root))))
(cl-call-next-method)))
(defun project-ask-user (dir)