]> git.eshelyaron.com Git - emacs.git/commitdiff
(xref--collect-matches): Move inhibit-modification-hooks binding down
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 14 May 2024 21:09:39 +0000 (00:09 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 May 2024 08:21:58 +0000 (10:21 +0200)
* lisp/progmodes/xref.el (xref--collect-matches): Move the
inhibit-modification-hooks binding a little down (bug#53749).
(xref--show-common-initialize): Add sharp-quoting.

(cherry picked from commit 85043246f14933eedf3d2c7c6f5ab603ec3f6a21)

lisp/progmodes/xref.el

index 8c1b2c97e9077e86bd315b56fe0827e0ae1a3d7d..3b3318afc659519cc1d685da9fe24af75095c713 100644 (file)
@@ -1400,7 +1400,7 @@ this variable to an alist with the following key-value pairs:
     (erase-buffer)
     (setq overlay-arrow-position nil)
     (xref--insert-xrefs xref-alist)
-    (add-hook 'post-command-hook 'xref--apply-truncation nil t)
+    (add-hook 'post-command-hook #'xref--apply-truncation nil t)
     (goto-char (point-min))
     (setq xref--original-window (assoc-default 'window alist)
           xref--original-window-intent (assoc-default 'display-action alist)
@@ -2253,10 +2253,7 @@ Such as the current syntax table and the applied syntax properties."
 (defun xref--collect-matches (hit regexp tmp-buffer syntax-needed)
   (pcase-let* ((`(,line ,file ,text) hit)
                (file (and file (concat xref--hits-remote-id file)))
-               (buf (xref--find-file-buffer file))
-               ;; This is fairly dangerouns, but improves performance
-               ;; for large lists, see https://debbugs.gnu.org/53749#227
-               (inhibit-modification-hooks t))
+               (buf (xref--find-file-buffer file)))
     (if buf
         (with-current-buffer buf
           (save-excursion
@@ -2271,6 +2268,9 @@ Such as the current syntax table and the applied syntax properties."
       ;; Using the temporary buffer is both a performance and a buffer
       ;; management optimization.
       (with-current-buffer tmp-buffer
+        ;; This let is fairly dangerouns, but improves performance
+        ;; for large lists, see https://debbugs.gnu.org/53749#227
+        (let ((inhibit-modification-hooks t))
         (erase-buffer)
         (when (and syntax-needed
                    (not (equal file xref--temp-buffer-file-name)))
@@ -2285,7 +2285,7 @@ Such as the current syntax table and the applied syntax properties."
           (setq-local xref--temp-buffer-file-name file)
           (setq-local inhibit-read-only t)
           (erase-buffer))
-        (insert text)
+        (insert text))
         (goto-char (point-min))
         (when syntax-needed
           (syntax-ppss-flush-cache (point)))