all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: grep.el regexp
Date: Tue, 19 Jul 2005 18:55:07 +0300	[thread overview]
Message-ID: <87ek9usqm4.fsf@jurta.org> (raw)
In-Reply-To: <E1Ds1XM-0008KR-Cr@fencepost.gnu.org> (Richard M. Stallman's message of "Mon, 11 Jul 2005 12:53:44 -0400")

Please find below a patch that removes recognition of all grep formats
except those listed in etc/grep.txt.

I'm also tempted to add recognition of column numbers for possible
search scripts that outputs them, with the rule:

 ("^\\([^:\n]+\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?"
  1 3 (4 . 5))

but it will recognize lines with the leading number and colon as the
column number (look the example in etc/grep.txt).  This wouldn't be
a problem if fontification was able to skip already fontified lines,
and not to apply the rule with column numbers when the rule that
accepts escape sequences for column calculation was applied.
But I haven't found a way to do that.

Index: lisp/progmodes/grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.39
diff -u -r1.39 grep.el
--- lisp/progmodes/grep.el	19 Jul 2005 14:21:23 -0000	1.39
+++ lisp/progmodes/grep.el	19 Jul 2005 15:54:54 -0000
@@ -248,13 +248,8 @@
 
 ;;;###autoload
 (defvar grep-regexp-alist
-  ;; rms: I removed the code to match parens around the line number
-  ;; because it causes confusion and so we will find out if anyone needs it.
-  ;; It causes confusion with a file name that contains a number in parens.
-  '(("^\\(.+?\\)\\([: \t]\\)+\
-\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
-\\(?:-\\(?:\\([0-9]+\\)\\4\\)?\\.?\\([0-9]+\\)?\\)?\\2"
-     1 (3 . 6) (5 . 7))
+  '(("^\\([^:\n]+\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2"
+     1 3)
     ("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\
 \\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
      2 3
@@ -283,6 +278,9 @@
 (defvar grep-match-face	'match
   "Face name to use for grep matches.")
 
+(defvar grep-context-face 'shadow
+  "Face name to use for grep context lines.")
+
 (defvar grep-mode-font-lock-keywords
    '(;; Command output lines.
      ("^\\([A-Za-z_0-9/\.+-]+\\)[ \t]*:" 1 font-lock-function-name-face)
@@ -297,6 +295,7 @@
       (0 '(face nil message nil help-echo nil mouse-face nil) t)
       (1 compilation-warning-face)
       (2 compilation-line-face))
+     ("^[^\n-]+-[0-9]+-.*" (0 grep-context-face))
      ;; Highlight grep matches and delete markers
      ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
       ;; Refontification does not work after the markers have been

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2005-07-19 15:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Djqpn-0003ih-62@fencepost.gnu.org>
     [not found] ` <87psuipj8b.fsf@jurta.org>
2005-06-20  3:50   ` grep.el regexp Richard Stallman
2005-06-22 16:27     ` Juri Linkov
2005-06-23 16:53       ` Richard M. Stallman
2005-06-27 23:57         ` Juri Linkov
2005-06-28  6:19           ` Stefan Monnier
2005-06-28 21:29             ` Richard M. Stallman
2005-06-29  3:52               ` Stefan Monnier
2005-06-29 20:43                 ` Richard M. Stallman
2005-06-30 17:34                   ` Stefan Monnier
2005-07-01  4:03                     ` Richard M. Stallman
2005-07-09  4:21                     ` Richard M. Stallman
2005-07-09 20:56                       ` Juri Linkov
2005-07-10 17:35                         ` Richard M. Stallman
2005-07-11  0:04                           ` Juri Linkov
2005-07-11 16:53                             ` Richard M. Stallman
2005-07-19 15:55                               ` Juri Linkov [this message]
2005-07-22  4:56                                 ` Richard M. Stallman
2005-07-22 18:09                                   ` Juri Linkov
2005-07-23 14:02                                     ` Richard M. Stallman
2005-07-19 15:59                               ` Juri Linkov
2005-07-24  0:01                                 ` Richard M. Stallman
2005-08-04  2:14                                   ` Juri Linkov
2005-08-04 20:45                                     ` Richard M. Stallman
2005-08-05  0:05                                       ` Juri Linkov
2005-08-05 20:37                                         ` Richard M. Stallman
2005-07-12  6:55                           ` Juri Linkov
2005-07-13  5:17                             ` Richard M. Stallman
2005-06-28 18:47           ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ek9usqm4.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.