[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104206: * lisp/progmodes/grep.el (gr
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104206: * lisp/progmodes/grep.el (grep-filter): Don't trip on partial lines. |
Date: |
Thu, 12 May 2011 12:10:17 -0300 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104206
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2011-05-12 12:10:17 -0300
message:
* lisp/progmodes/grep.el (grep-filter): Don't trip on partial lines.
modified:
lisp/ChangeLog
lisp/progmodes/grep.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-05-12 12:55:10 +0000
+++ b/lisp/ChangeLog 2011-05-12 15:10:17 +0000
@@ -1,5 +1,7 @@
2011-05-12 Stefan Monnier <address@hidden>
+ * progmodes/grep.el (grep-filter): Don't trip on partial lines.
+
* shell.el (shell-completion-vars): New function.
(shell-mode):
* simple.el (read-shell-command): Use it.
=== modified file 'lisp/progmodes/grep.el'
--- a/lisp/progmodes/grep.el 2011-05-08 05:17:17 +0000
+++ b/lisp/progmodes/grep.el 2011-05-12 15:10:17 +0000
@@ -476,17 +476,23 @@
"Handle match highlighting escape sequences inserted by the grep process.
This function is called from `compilation-filter-hook'."
(save-excursion
- (let ((end (point-marker)))
- ;; Highlight grep matches and delete marking sequences.
- (goto-char compilation-filter-start)
- (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1)
- (replace-match (propertize (match-string 1)
- 'face nil 'font-lock-face grep-match-face)
- t t))
- ;; Delete all remaining escape sequences
- (goto-char compilation-filter-start)
- (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
- (replace-match "" t t)))))
+ (forward-line 0)
+ (let ((end (point)))
+ (goto-char compilation-filter-start)
+ (forward-line 0)
+ ;; Only operate on whole lines so we don't get caught with part of an
+ ;; escape sequence in one chunk and the rest in another.
+ (when (< (point) end)
+ (setq end (copy-marker end))
+ ;; Highlight grep matches and delete marking sequences.
+ (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1)
+ (replace-match (propertize (match-string 1)
+ 'face nil 'font-lock-face grep-match-face)
+ t t))
+ ;; Delete all remaining escape sequences
+ (goto-char compilation-filter-start)
+ (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
+ (replace-match "" t t))))))
(defun grep-probe (command args &optional func result)
(let (process-file-side-effects)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104206: * lisp/progmodes/grep.el (grep-filter): Don't trip on partial lines.,
Stefan Monnier <=