diff options
| author | Juri Linkov | 2011-09-05 11:20:02 +0300 |
|---|---|---|
| committer | Juri Linkov | 2011-09-05 11:20:02 +0300 |
| commit | f62bd846552a090f3ba5e136d6d9cdb4c07ed7be (patch) | |
| tree | b199c66feaaaa79217d7fbcd5c5f11f16875f68e | |
| parent | 045820ecd3b3f4396474fae297945d58d9187e6a (diff) | |
| download | emacs-f62bd846552a090f3ba5e136d6d9cdb4c07ed7be.tar.gz emacs-f62bd846552a090f3ba5e136d6d9cdb4c07ed7be.zip | |
Grep related fixes.
* etc/grep.txt: Add `eval' to the Local Variables section that
emulates `grep-filter'.
* lisp/progmodes/grep.el (grep-filter): Avoid incomplete processing by
keeping point where processing of grep matches begins, and
continue to delete remaining escape sequences from the same point.
(grep-filter): Make leading zero optional in "0?1;31m" because
git-grep emits "\033[1;31m" escape sequences unlike expected
"\033[01;31m" as GNU Grep does.
(grep-process-setup): Replace obsolete "ml=" with newer "sl=".
Fixes: debbugs:9408
| -rw-r--r-- | etc/ChangeLog | 5 | ||||
| -rw-r--r-- | etc/grep.txt | 1 | ||||
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 9 |
4 files changed, 21 insertions, 4 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog index 24c0fd54422..0749862f676 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * grep.txt: Add `eval' to the Local Variables section that | ||
| 4 | emulates `grep-filter'. | ||
| 5 | |||
| 1 | 2011-08-30 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2011-08-30 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * MACHINES: Remove obsolete info and update a bit (Bug#9404). | 8 | * MACHINES: Remove obsolete info and update a bit (Bug#9404). |
diff --git a/etc/grep.txt b/etc/grep.txt index 9a3159f6b08..01ffa9f3ef8 100644 --- a/etc/grep.txt +++ b/etc/grep.txt | |||
| @@ -103,5 +103,6 @@ COPYING PERMISSIONS: | |||
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | ;;; Local Variables: | 105 | ;;; Local Variables: |
| 106 | ;;; eval: (let ((inhibit-read-only t) (compilation-filter-start (point-min))) (save-excursion (goto-char (point-max)) (grep-filter) (set-buffer-modified-p nil))) | ||
| 106 | ;;; buffer-read-only: t | 107 | ;;; buffer-read-only: t |
| 107 | ;;; End: | 108 | ;;; End: |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 59ecd1a3c12..d30010d6016 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2011-09-05 Juri Linkov <juri@jurta.org> | 1 | 2011-09-05 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * progmodes/grep.el (grep-filter): Avoid incomplete processing by | ||
| 4 | keeping point where processing of grep matches begins, and | ||
| 5 | continue to delete remaining escape sequences from the same point. | ||
| 6 | (grep-filter): Make leading zero optional in "0?1;31m" because | ||
| 7 | git-grep emits "\033[1;31m" escape sequences unlike expected | ||
| 8 | "\033[01;31m" as GNU Grep does (bug#9408). | ||
| 9 | (grep-process-setup): Replace obsolete "ml=" with newer "sl=". | ||
| 10 | |||
| 11 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 12 | |||
| 3 | * subr.el (y-or-n-p): Capitalize "yes". | 13 | * subr.el (y-or-n-p): Capitalize "yes". |
| 4 | 14 | ||
| 5 | 2011-09-04 Michael Albinus <michael.albinus@gmx.de> | 15 | 2011-09-04 Michael Albinus <michael.albinus@gmx.de> |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 709f01444bf..eeebcc6648f 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -459,7 +459,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 459 | ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions | 459 | ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions |
| 460 | (setenv "GREP_COLOR" "01;31") | 460 | (setenv "GREP_COLOR" "01;31") |
| 461 | ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions | 461 | ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions |
| 462 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne")) | 462 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne")) |
| 463 | (set (make-local-variable 'compilation-exit-message-function) | 463 | (set (make-local-variable 'compilation-exit-message-function) |
| 464 | (lambda (status code msg) | 464 | (lambda (status code msg) |
| 465 | (if (eq status 'exit) | 465 | (if (eq status 'exit) |
| @@ -480,20 +480,21 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 480 | This function is called from `compilation-filter-hook'." | 480 | This function is called from `compilation-filter-hook'." |
| 481 | (save-excursion | 481 | (save-excursion |
| 482 | (forward-line 0) | 482 | (forward-line 0) |
| 483 | (let ((end (point))) | 483 | (let ((end (point)) beg) |
| 484 | (goto-char compilation-filter-start) | 484 | (goto-char compilation-filter-start) |
| 485 | (forward-line 0) | 485 | (forward-line 0) |
| 486 | (setq beg (point)) | ||
| 486 | ;; Only operate on whole lines so we don't get caught with part of an | 487 | ;; Only operate on whole lines so we don't get caught with part of an |
| 487 | ;; escape sequence in one chunk and the rest in another. | 488 | ;; escape sequence in one chunk and the rest in another. |
| 488 | (when (< (point) end) | 489 | (when (< (point) end) |
| 489 | (setq end (copy-marker end)) | 490 | (setq end (copy-marker end)) |
| 490 | ;; Highlight grep matches and delete marking sequences. | 491 | ;; Highlight grep matches and delete marking sequences. |
| 491 | (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1) | 492 | (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1) |
| 492 | (replace-match (propertize (match-string 1) | 493 | (replace-match (propertize (match-string 1) |
| 493 | 'face nil 'font-lock-face grep-match-face) | 494 | 'face nil 'font-lock-face grep-match-face) |
| 494 | t t)) | 495 | t t)) |
| 495 | ;; Delete all remaining escape sequences | 496 | ;; Delete all remaining escape sequences |
| 496 | (goto-char compilation-filter-start) | 497 | (goto-char beg) |
| 497 | (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) | 498 | (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) |
| 498 | (replace-match "" t t)))))) | 499 | (replace-match "" t t)))))) |
| 499 | 500 | ||