aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2021-01-06 19:41:55 +0200
committerDmitry Gutov2021-01-06 23:07:22 +0200
commit665b4e7c4e093391a353506e7b2385f0902db70b (patch)
treee9eab41311a7e59ee7061c9a2b7f7f691c092503 /lisp
parent7936c8a96060fa118220d4d874f740dc75e2fe47 (diff)
downloademacs-665b4e7c4e093391a353506e7b2385f0902db70b.tar.gz
emacs-665b4e7c4e093391a353506e7b2385f0902db70b.zip
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')
-rw-r--r--lisp/cedet/semantic/symref/grep.el3
-rw-r--r--lisp/progmodes/project.el3
-rw-r--r--lisp/progmodes/xref.el3
3 files changed, 6 insertions, 3 deletions
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 5f9a3fa352e..9f0ac38ec75 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -168,7 +168,8 @@ This shell should support pipe redirect syntax."
168 (erase-buffer) 168 (erase-buffer)
169 (setq default-directory rootdir) 169 (setq default-directory rootdir)
170 (let ((cmd (semantic-symref-grep-use-template 170 (let ((cmd (semantic-symref-grep-use-template
171 (file-local-name rootdir) filepattern grepflags greppat))) 171 (file-name-as-directory (file-local-name rootdir))
172 filepattern grepflags greppat)))
172 (process-file semantic-symref-grep-shell nil b nil 173 (process-file semantic-symref-grep-shell nil b nil
173 shell-command-switch cmd))) 174 shell-command-switch cmd)))
174 (setq ans (semantic-symref-parse-tool-output tool b)) 175 (setq ans (semantic-symref-parse-tool-output tool b))
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."
291 (localdir (file-local-name (expand-file-name dir))) 291 (localdir (file-local-name (expand-file-name dir)))
292 (command (format "%s %s %s -type f %s -print0" 292 (command (format "%s %s %s -type f %s -print0"
293 find-program 293 find-program
294 localdir 294 ;; In case DIR is a symlink.
295 (file-name-as-directory localdir)
295 (xref--find-ignores-arguments ignores localdir) 296 (xref--find-ignores-arguments ignores localdir)
296 (if files 297 (if files
297 (concat (shell-quote-argument "(") 298 (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."
1374 ;; do that reliably enough, without creating false negatives? 1374 ;; do that reliably enough, without creating false negatives?
1375 (command (xref--rgrep-command (xref--regexp-to-extended regexp) 1375 (command (xref--rgrep-command (xref--regexp-to-extended regexp)
1376 files 1376 files
1377 (file-local-name (expand-file-name dir)) 1377 (file-name-as-directory
1378 (file-local-name (expand-file-name dir)))
1378 ignores)) 1379 ignores))
1379 (def default-directory) 1380 (def default-directory)
1380 (buf (get-buffer-create " *xref-grep*")) 1381 (buf (get-buffer-create " *xref-grep*"))