summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-01-06 19:41:55 +0200
committerDmitry Gutov <dgutov@yandex.ru>2021-01-06 23:07:22 +0200
commit665b4e7c4e093391a353506e7b2385f0902db70b (patch)
treee9eab41311a7e59ee7061c9a2b7f7f691c092503 /lisp/progmodes
parent7936c8a96060fa118220d4d874f740dc75e2fe47 (diff)
downloademacs-665b4e7c4e093391a353506e7b2385f0902db70b.tar.gz
Proof some searches and file listings against symlinks
* lisp/progmodes/project.el (project--files-in-directory): Make sure the directory includes the trailing slash in case it's a symlink, discussed in https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00345.html. * lisp/progmodes/xref.el (xref-matches-in-directory): Same. * lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search): Same.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/project.el3
-rw-r--r--lisp/progmodes/xref.el3
2 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d417382c0df..62c3cf44cb6 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -291,7 +291,8 @@ to find the list of ignores for each directory."
(localdir (file-local-name (expand-file-name dir)))
(command (format "%s %s %s -type f %s -print0"
find-program
- localdir
+ ;; In case DIR is a symlink.
+ (file-name-as-directory localdir)
(xref--find-ignores-arguments ignores localdir)
(if files
(concat (shell-quote-argument "(")
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 2fefc23e199..b393b8d0f1a 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1374,7 +1374,8 @@ IGNORES is a list of glob patterns for files to ignore."
;; do that reliably enough, without creating false negatives?
(command (xref--rgrep-command (xref--regexp-to-extended regexp)
files
- (file-local-name (expand-file-name dir))
+ (file-name-as-directory
+ (file-local-name (expand-file-name dir)))
ignores))
(def default-directory)
(buf (get-buffer-create " *xref-grep*"))