branch: externals/urgrep
commit 4dd2a9a60196aa17640593659ee8aa550a9bf2e0
Author: Jim Porter <jporterb...@gmail.com>
Commit: Jim Porter <jporterb...@gmail.com>

    Require Emacs 28+
    
    Under Emacs 27, it's more difficult to correctly handle fontification for
    grouped *and* ungrouped results.
---
 .github/workflows/build.yml |  2 +-
 NEWS.md                     |  5 ++++-
 urgrep.el                   | 35 ++++++++++++++---------------------
 3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6b8bd9d74f..ed9538b0ec 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,7 +11,7 @@ jobs:
     strategy:
       matrix:
         emacs-version: [
-          '27.2', '28.1', '28.2', '29.1', '29.2', '29.3', '30.1', 'snapshot'
+          '28.1', '28.2', '29.1', '29.2', '29.3', '30.1', 'snapshot'
         ]
         action: ['check', 'lint']
 
diff --git a/NEWS.md b/NEWS.md
index ec9538b685..67a195af7b 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,9 @@
 # Urgrep News
 
-## v0.5.3 (in progress)
+## v0.6.0 (in progress)
+
+### Breaking changes
+- Require Emacs 28+
 
 ### Bug fixes
 - Improve fontification for file/line number to avoid problems with matches
diff --git a/urgrep.el b/urgrep.el
index da86bf5e98..294771590a 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -4,9 +4,9 @@
 
 ;; Author: Jim Porter
 ;; URL: https://github.com/jimporter/urgrep
-;; Version: 0.5.3-git
+;; Version: 0.6.0-git
 ;; Keywords: grep, search
-;; Package-Requires: ((emacs "27.1") (compat "29.1.0.1") (project "0.3.0"))
+;; Package-Requires: ((emacs "28.1") (compat "29.1.0.1") (project "0.3.0"))
 
 ;; This file is NOT part of GNU Emacs.
 
@@ -956,16 +956,6 @@ file name and line number."
      (0 'urgrep-context t)
      (2 `(face nil display ,(match-string 1)) nil t))))
 
-(defvar urgrep--column-end-adjustment
-  (if (< emacs-major-version 28) 0 1)
-  "Handle core Emacs changes to the column range for `compile-mode' matches.
-In Emacs 28+, the column range for matches is closed, but in
-previous versions, it's half-open.  Use this to adjust the value
-as needed in `urgrep--column-end'.
-
-For more details on the change, see
-<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49624>.")
-
 (defun urgrep--column-begin ()
   "Look forwards for the match highlight to compute the beginning column."
   (let* ((beg (match-end 0))
@@ -982,19 +972,22 @@ For more details on the change, see
          (mend (and mbeg (next-single-property-change mbeg 'font-lock-face nil
                                                       end))))
     (when mend
-      (- mend beg urgrep--column-end-adjustment))))
+      ;; In Emacs 28+, the column range for matches in compile.el is closed, 
but
+      ;; our calculation is half-open.  So subtract 1 from the result to make 
it
+      ;; closed.  For more details on the change, see
+      ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49624>.
+      (- mend beg 1))))
 
 (defun urgrep--grouped-filename ()
   "Look backwards for the filename when a match is found in grouped output."
   (save-excursion
-    (if-let* (;; Make sure the line doesn't start with a filename...
-              ((not (get-text-property (match-beginning 0) 'urgrep-file-name)))
-              ;; ... and that we've seen a file name previously.
-              (match (text-property-search-backward 'urgrep-file-name)))
-        (buffer-substring-no-properties (prop-match-beginning match)
-                                        (prop-match-end match))
-      ;; Emacs 27 and lower will break if we return nil from this function.
-      (when (< emacs-major-version 28) "*unknown*"))))
+    (when-let* (;; Make sure the line doesn't start with a filename...
+                ((not (get-text-property (match-beginning 0)
+                                         'urgrep-file-name)))
+                ;; ... and that we've seen a file name previously.
+                (match (text-property-search-backward 'urgrep-file-name)))
+      (buffer-substring-no-properties (prop-match-beginning match)
+                                      (prop-match-end match)))))
 
 (defconst urgrep-regexp-alist
   `(;; Grouped matches

Reply via email to