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.
This commit is contained in:
Dmitry Gutov 2021-01-06 19:41:55 +02:00
parent 7936c8a960
commit 665b4e7c4e
3 changed files with 6 additions and 3 deletions

View file

@ -168,7 +168,8 @@ This shell should support pipe redirect syntax."
(erase-buffer)
(setq default-directory rootdir)
(let ((cmd (semantic-symref-grep-use-template
(file-local-name rootdir) filepattern grepflags greppat)))
(file-name-as-directory (file-local-name rootdir))
filepattern grepflags greppat)))
(process-file semantic-symref-grep-shell nil b nil
shell-command-switch cmd)))
(setq ans (semantic-symref-parse-tool-output tool b))

View file

@ -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 "(")

View file

@ -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*"))