emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 90a7233 2/2: More per-match overhead reduction


From: Dmitry Gutov
Subject: master 90a7233 2/2: More per-match overhead reduction
Date: Thu, 23 Sep 2021 13:37:38 -0400 (EDT)

branch: master
commit 90a7233199a134fcab9f89e46e1b02e74011b4da
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    More per-match overhead reduction
    
    * lisp/progmodes/xref.el (xref--show-common-initialize)
    (xref-revert-buffer): Inhibit modification hooks (bug#50733).
    (xref--insert-xrefs): Cosmetics (no measurable difference here).
---
 lisp/progmodes/xref.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 88ee1d5..62f66b2 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -966,20 +966,25 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...), 
where
 GROUP is a string for decoration purposes and XREF is an
 `xref-item' object."
   (require 'compile) ; For the compilation faces.
-  (cl-loop for ((group . xrefs) . more1) on xref-alist
+  (cl-loop for (group . xrefs) in xref-alist
            for max-line-width =
            (cl-loop for xref in xrefs
                     maximize (let ((line (xref-location-line
                                           (oref xref location))))
-                               (length (and line (format "%d" line)))))
+                               (and line (1+ (floor (log line 10))))))
            for line-format = (and max-line-width
                                   (format "%%%dd: " max-line-width))
+           with item-text-props = (list 'mouse-face 'highlight
+                                        'keymap xref--button-map
+                                        'help-echo
+                                        (concat "mouse-2: display in another 
window, "
+                                                "RET or mouse-1: follow 
reference"))
            with prev-group = nil
            with prev-line = nil
            do
            (xref--insert-propertized '(face xref-file-header xref-group t)
                                      group "\n")
-           (cl-loop for (xref . more2) on xrefs do
+           (cl-loop for xref in xrefs do
                     (with-slots (summary location) xref
                       (let* ((line (xref-location-line location))
                              (prefix
@@ -995,14 +1000,9 @@ GROUP is a string for decoration purposes and XREF is an
                                    (or (null line)
                                        (not (equal prev-line line))))
                           (insert "\n"))
-                        (xref--insert-propertized
-                         (list 'xref-item xref
-                               'mouse-face 'highlight
-                               'keymap xref--button-map
-                               'help-echo
-                               (concat "mouse-2: display in another window, "
-                                       "RET or mouse-1: follow reference"))
-                         prefix summary)
+                        (xref--insert-propertized (nconc (list 'xref-item xref)
+                                                         item-text-props)
+                                                  prefix summary)
                         (setq prev-line line
                               prev-group group))))
            (insert "\n"))
@@ -1084,7 +1084,8 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)."
 (defun xref--show-common-initialize (xref-alist fetcher alist)
   (setq buffer-undo-list nil)
   (let ((inhibit-read-only t)
-        (buffer-undo-list t))
+        (buffer-undo-list t)
+        (inhibit-modification-hooks t))
     (erase-buffer)
     (setq overlay-arrow-position nil)
     (xref--insert-xrefs xref-alist)
@@ -1098,7 +1099,8 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)."
   "Refresh the search results in the current buffer."
   (interactive)
   (let ((inhibit-read-only t)
-        (buffer-undo-list t))
+        (buffer-undo-list t)
+        (inhibit-modification-hooks t))
     (save-excursion
       (condition-case err
           (let ((alist (xref--analyze (funcall xref--fetcher))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]