aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-05-12 12:10:17 -0300
committerStefan Monnier2011-05-12 12:10:17 -0300
commitc89be45f2e6a1deed1204124fd2997002ed41a67 (patch)
tree8a23d0867359ff63928b387287c5d7f6c90b9c47
parent914a0ae1bab4f6f76c0b2654e0ca78fdb07f294a (diff)
downloademacs-c89be45f2e6a1deed1204124fd2997002ed41a67.tar.gz
emacs-c89be45f2e6a1deed1204124fd2997002ed41a67.zip
* lisp/progmodes/grep.el (grep-filter): Don't trip on partial lines.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/progmodes/grep.el26
2 files changed, 18 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bac4931f4eb..5204622f641 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12011-05-12 Stefan Monnier <monnier@iro.umontreal.ca> 12011-05-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * progmodes/grep.el (grep-filter): Don't trip on partial lines.
4
3 * shell.el (shell-completion-vars): New function. 5 * shell.el (shell-completion-vars): New function.
4 (shell-mode): 6 (shell-mode):
5 * simple.el (read-shell-command): Use it. 7 * simple.el (read-shell-command): Use it.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 12295efc2d1..143220ad28a 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -476,17 +476,23 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
476 "Handle match highlighting escape sequences inserted by the grep process. 476 "Handle match highlighting escape sequences inserted by the grep process.
477This function is called from `compilation-filter-hook'." 477This function is called from `compilation-filter-hook'."
478 (save-excursion 478 (save-excursion
479 (let ((end (point-marker))) 479 (forward-line 0)
480 ;; Highlight grep matches and delete marking sequences. 480 (let ((end (point)))
481 (goto-char compilation-filter-start) 481 (goto-char compilation-filter-start)
482 (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1) 482 (forward-line 0)
483 (replace-match (propertize (match-string 1) 483 ;; Only operate on whole lines so we don't get caught with part of an
484 'face nil 'font-lock-face grep-match-face) 484 ;; escape sequence in one chunk and the rest in another.
485 t t)) 485 (when (< (point) end)
486 ;; Delete all remaining escape sequences 486 (setq end (copy-marker end))
487 (goto-char compilation-filter-start) 487 ;; Highlight grep matches and delete marking sequences.
488 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) 488 (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1)
489 (replace-match "" t t))))) 489 (replace-match (propertize (match-string 1)
490 'face nil 'font-lock-face grep-match-face)
491 t t))
492 ;; Delete all remaining escape sequences
493 (goto-char compilation-filter-start)
494 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
495 (replace-match "" t t))))))
490 496
491(defun grep-probe (command args &optional func result) 497(defun grep-probe (command args &optional func result)
492 (let (process-file-side-effects) 498 (let (process-file-side-effects)