emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117959: * progmodes/grep.el (grep-regexp-alist): Us


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117959: * progmodes/grep.el (grep-regexp-alist): Use more-accurate regexp.
Date: Fri, 26 Sep 2014 18:32:55 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117959
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2014-09-26 11:32:48 -0700
message:
  * progmodes/grep.el (grep-regexp-alist): Use more-accurate regexp.
  
  Do not match file names that end in '/', as they cannot be 'grep'
  hits nowadays.  This prevents confusion when 'grep -r' reports a
  match in a file whose basename is ':12345:'.  Conversely, do not
  require exactly the same sequence of spaces and tabs after both
  colons, and allow spaces or tabs before the second colon, as per
  the POSIX spec for 'grep' output.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/grep.el         grep.el-20091113204419-o5vbwnq5f7feedwu-2948
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-26 00:15:21 +0000
+++ b/lisp/ChangeLog    2014-09-26 18:32:48 +0000
@@ -1,3 +1,13 @@
+2014-09-26  Paul Eggert  <address@hidden>
+
+       * progmodes/grep.el (grep-regexp-alist): Use more-accurate regexp.
+       Do not match file names that end in '/', as they cannot be 'grep'
+       hits nowadays.  This prevents confusion when 'grep -r' reports a
+       match in a file whose basename is ':12345:'.  Conversely, do not
+       require exactly the same sequence of spaces and tabs after both
+       colons, and allow spaces or tabs before the second colon, as per
+       the POSIX spec for 'grep' output.
+
 2014-09-26  Leo Liu  <address@hidden>
 
        Add cl-parse-integer based on parse-integer (Bug#18557)

=== modified file 'lisp/progmodes/grep.el'
--- a/lisp/progmodes/grep.el    2014-09-17 00:07:12 +0000
+++ b/lisp/progmodes/grep.el    2014-09-26 18:32:48 +0000
@@ -343,16 +343,11 @@
 ;;;###autoload
 (defconst grep-regexp-alist
   '(
-    ;; Rule to match column numbers is commented out since no known grep
-    ;; produces them
-    ;; ("^\\(.+?\\)\\(:[ 
\t]*\\)\\([1-9][0-9]*\\)\\2\\(?:\\([1-9][0-9]*\\)\\(?:-\\([1-9][0-9]*\\)\\)?\\2\\)?"
-    ;;  1 3 (4 . 5))
-    ;; Note that we want to use as tight a regexp as we can to try and
-    ;; handle weird file names (with colons in them) as well as possible.
-    ;; E.g. we use [1-9][0-9]* rather than [0-9]+ so as to accept ":034:"
-    ;; in file names.
-    ("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2"
-     1 3
+    ;; Use a tight regexp to handle weird file names (with colons
+    ;; in them) as well as possible.  E.g., use [1-9][0-9]* rather
+    ;; than [0-9]+ so as to accept ":034:" in file names.
+    ("^\\(.*?[^/\n]\\):[ \t]*\\([1-9][0-9]*\\)[ \t]*:"
+     1 2
      ;; Calculate column positions (col . end-col) of first grep match on a 
line
      ((lambda ()
        (when grep-highlight-matches


reply via email to

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