]> git.eshelyaron.com Git - emacs.git/commitdiff
xref-matches-in-files: Use with-connection-local-variables
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 26 Aug 2022 22:09:47 +0000 (01:09 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 26 Aug 2022 22:09:47 +0000 (01:09 +0300)
* lisp/progmodes/xref.el (xref-matches-in-files):
Use with-connection-local-variables (bug#57385).

lisp/progmodes/xref.el

index f3db971bcf223ec1d4d88bae4cc16349da2e599c..a7e372c2ac6d37451b588a3ec55a3561f7720fb5 100644 (file)
@@ -1764,6 +1764,12 @@ utility function used by commands like `dired-do-find-regexp' and
   :version "28.1"
   :package-version '(xref . "1.0.4"))
 
+(defmacro xref--with-connection-local-variables (&rest body)
+  (declare (debug t))
+  (if (>= emacs-major-version 27)
+      `(with-connection-local-variables ,@body)
+    `(progn ,@body)))
+
 ;;;###autoload
 (defun xref-matches-in-files (regexp files)
   "Find all matches for REGEXP in FILES.
@@ -1810,13 +1816,14 @@ to control which program to use when looking for matches."
         (insert (mapconcat #'identity files "\0"))
         (setq default-directory dir)
         (setq status
-              (xref--process-file-region (point-min)
-                                         (point-max)
-                                         shell-file-name
-                                         output
-                                         nil
-                                         shell-command-switch
-                                         command)))
+              (xref--with-connection-local-variables
+               (xref--process-file-region (point-min)
+                                          (point-max)
+                                          shell-file-name
+                                          output
+                                          nil
+                                          shell-command-switch
+                                          command))))
       (goto-char (point-min))
       (when (and (/= (point-min) (point-max))
                  (not (looking-at grep-re))