emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/consult bfd884597b 2/3: consult--grep-format: Share fil


From: ELPA Syncer
Subject: [elpa] externals/consult bfd884597b 2/3: consult--grep-format: Share file name for candidates, used as group title
Date: Thu, 26 Jan 2023 16:57:26 -0500 (EST)

branch: externals/consult
commit bfd884597b069c138246066375f93cac23ad8a98
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult--grep-format: Share file name for candidates, used as group title
---
 consult.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/consult.el b/consult.el
index a560d9e3b7..67e3a1dc01 100644
--- a/consult.el
+++ b/consult.el
@@ -4548,19 +4548,23 @@ BUILDER is the command argument builder."
             (setq highlight (plist-get tmp :highlight))))
         (funcall async action))
        ((consp action)
-        (let (result)
+        (let ((file "") (file-len 0) result)
           (save-match-data
             (dolist (str action)
               (when (and (string-match consult--grep-match-regexp str)
                          ;; Filter out empty context lines
                          (or (/= (aref str (match-beginning 3)) ?-)
                              (/= (match-end 0) (length str))))
-                (let* ((file (match-string 1 str))
-                       (line (match-string 2 str))
+                (unless (and (= file-len (- (match-end 1) (match-beginning 1)))
+                             (eq t (compare-strings
+                                    file 0 file-len
+                                    str (match-beginning 1) (match-end 1) 
nil)))
+                  (setq file (match-string 1 str)
+                        file-len (length file)))
+                (let* ((line (match-string 2 str))
                        (ctx (= (aref str (match-beginning 3)) ?-))
                        (sep (if ctx "-" ":"))
                        (content (substring str (match-end 0)))
-                       (file-len (length file))
                        (line-len (length line)))
                   (when (length> content consult-grep-max-columns)
                     (setq content (substring content 0 
consult-grep-max-columns)))



reply via email to

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