diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2016-01-07 20:14:40 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2016-01-07 20:56:09 +0300 |
commit | ed41d117a434abd28df4585663c2311c87160d1c (patch) | |
tree | 7a258ca8ce5258be5f8503cc69c8cc1e069b7f67 /lisp/progmodes/xref.el | |
parent | 056da45d2c9a82c3ad8f0c2d3e16bb4864aa7838 (diff) | |
download | emacs-ed41d117a434abd28df4585663c2311c87160d1c.tar.gz |
Add project-find-file and project-or-external-find-file
* lisp/minibuffer.el (completion-category-defaults):
Add `project-file' category.
* lisp/progmodes/project.el (project-find-file)
(project-or-external-find-file): New commands.
(project--find-file-in): New private function.
* lisp/progmodes/xref.el (xref-collect-matches): Use
`expand-file-name' on DIR, to expand the tildes.
(xref--find-ignores-arguments): Extract from
`xref--rgrep-command'.
Diffstat (limited to 'lisp/progmodes/xref.el')
-rw-r--r-- | lisp/progmodes/xref.el | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ae5ec61520d..59700115879 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -876,7 +876,9 @@ IGNORES is a list of glob patterns." grep-find-template t t)) (grep-highlight-matches nil) (command (xref--rgrep-command (xref--regexp-to-extended regexp) - files dir ignores)) + files + (expand-file-name dir) + ignores)) (orig-buffers (buffer-list)) (buf (get-buffer-create " *xref-grep*")) (grep-re (caar grep-regexp-alist)) @@ -912,23 +914,28 @@ IGNORES is a list of glob patterns." " " (shell-quote-argument ")")) dir - (concat - (shell-quote-argument "(") - " -path " - (mapconcat - (lambda (ignore) - (when (string-match-p "/\\'" ignore) - (setq ignore (concat ignore "*"))) - (if (string-match "\\`\\./" ignore) - (setq ignore (replace-match dir t t ignore)) - (unless (string-prefix-p "*" ignore) - (setq ignore (concat "*/" ignore)))) - (shell-quote-argument ignore)) - ignores - " -o -path ") - " " - (shell-quote-argument ")") - " -prune -o "))) + (xref--find-ignores-arguments ignores dir))) + +(defun xref--find-ignores-arguments (ignores dir) + ;; `shell-quote-argument' quotes the tilde as well. + (cl-assert (not (string-match-p "\\`~" dir))) + (concat + (shell-quote-argument "(") + " -path " + (mapconcat + (lambda (ignore) + (when (string-match-p "/\\'" ignore) + (setq ignore (concat ignore "*"))) + (if (string-match "\\`\\./" ignore) + (setq ignore (replace-match dir t t ignore)) + (unless (string-prefix-p "*" ignore) + (setq ignore (concat "*/" ignore)))) + (shell-quote-argument ignore)) + ignores + " -o -path ") + " " + (shell-quote-argument ")") + " -prune -o ")) (defun xref--regexp-to-extended (str) (replace-regexp-in-string |