GNU bug report logs - #40940
27.0.91; project-query-replace-regexp stops too early

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> runbox.com>

Date: Tue, 28 Apr 2020 14:57:02 UTC

Severity: normal

Found in version 27.0.91

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 40940 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: dgutov <at> yandex.ru
Cc: simenheg <at> runbox.com, monnier <at> IRO.UMontreal.CA, 40940 <at> debbugs.gnu.org
Subject: Re: bug#40940: 27.0.91; project-query-replace-regexp stops too early
Date: Wed, 29 Apr 2020 12:24:36 +0300
> Date: Wed, 29 Apr 2020 11:37:53 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: monnier <at> IRO.UMontreal.CA, 40940 <at> debbugs.gnu.org, dgutov <at> yandex.ru
> 
> > From: Simen Heggestøyl <simenheg <at> runbox.com>
> > Cc: Dmitry Gutov <dgutov <at> yandex.ru>,  40940 <at> debbugs.gnu.org,
> >   monnier <at> IRO.UMontreal.CA
> > Date: Wed, 29 Apr 2020 10:29:18 +0200
> > 
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> > 
> > > Is this a regression since Emacs 26?
> > 
> > project-query-replace-regexp is new in Emacs 27.
> 
> OK, so we should fix this on the release branch.

First, this is broken if the shell doesn't expand ~/ or if the Emacs
notion of the home directory is different from that of the shell.
Here's the proposed patch (ignoring the whitespace changes); OK to
push to the emacs-27 branch?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1f4cbe9..dbc967b 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -185,13 +185,17 @@ project--files-in-directory
   (require 'find-dired)
   (require 'xref)
   (defvar find-name-arg)
-  (let ((default-directory dir)
+  (let* ((default-directory dir)
+         (dirname (file-remote-p dir 'localname))
+         (dirname (or dirname
+                      ;; Make sure ~/ etc. in local directory name is
+                      ;; expanded and not left for the shell command
+                      ;; to interpret.
+                      (expand-file-name dir)))
          (command (format "%s %s %s -type f %s -print0"
                           find-program
-                         (file-local-name dir)
-                         (xref--find-ignores-arguments
-                          ignores
-                          (expand-file-name dir))
+                          dirname
+                          (xref--find-ignores-arguments ignores dirname)
                           (if files
                               (concat (shell-quote-argument "(")
                                       " " find-name-arg " "




This bug report was last modified 5 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.