[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105677: * lisp/progmodes/grep.el (gr
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105677: * lisp/progmodes/grep.el (grep-regexp-alist): Calculate column positions |
Date: |
Wed, 07 Sep 2011 15:00:52 +0300 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105677
fixes bug(s): http://debbugs.gnu.org/9438
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Wed 2011-09-07 15:00:52 +0300
message:
* lisp/progmodes/grep.el (grep-regexp-alist): Calculate column positions
based on text properties put by `grep-filter' instead of matching
escape sequences.
(grep-mode): Set buffer-local `compilation-error-screen-columns'
to the value of `grep-error-screen-columns'.
modified:
lisp/ChangeLog
lisp/progmodes/grep.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-09-07 11:46:56 +0000
+++ b/lisp/ChangeLog 2011-09-07 12:00:52 +0000
@@ -1,5 +1,13 @@
2011-09-07 Juri Linkov <address@hidden>
+ * progmodes/grep.el (grep-regexp-alist): Calculate column positions
+ based on text properties put by `grep-filter' instead of matching
+ escape sequences.
+ (grep-mode): Set buffer-local `compilation-error-screen-columns'
+ to the value of `grep-error-screen-columns' (bug#9438).
+
+2011-09-07 Juri Linkov <address@hidden>
+
* simple.el (next-error-highlight, next-error-highlight-no-select):
Doc fix (bug#9432).
=== modified file 'lisp/progmodes/grep.el'
--- a/lisp/progmodes/grep.el 2011-09-05 09:55:11 +0000
+++ b/lisp/progmodes/grep.el 2011-09-07 12:00:52 +0000
@@ -344,7 +344,24 @@
;;;###autoload
(defconst grep-regexp-alist
'(("^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)\\2"
- 1 3)
+ 1 3
+ ;; Calculate column positions (col . end-col) of first grep match on a
line
+ ((lambda ()
+ (when grep-highlight-matches
+ (let* ((beg (match-end 0))
+ (end (save-excursion (goto-char beg) (line-end-position)))
+ (mbeg (text-property-any beg end 'font-lock-face 'match)))
+ (when mbeg
+ (- mbeg beg)))))
+ .
+ (lambda ()
+ (when grep-highlight-matches
+ (let* ((beg (match-end 0))
+ (end (save-excursion (goto-char beg) (line-end-position)))
+ (mbeg (text-property-any beg end 'font-lock-face 'match))
+ (mend (and mbeg (next-single-property-change mbeg
'font-lock-face nil end))))
+ (when mend
+ (- mend beg)))))))
;; Rule to match column numbers is commented out since no known grep
;; produces them
;; ("^\\(.+?\\)\\(:[
\t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?"
@@ -353,17 +370,6 @@
;; 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.
- ("^\\(\\(.+?\\):\\([1-9][0-9]*\\):\\).*?\
-\\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
- 2 3
- ;; Calculate column positions (beg . end) of first grep match on a line
- ((lambda ()
- (setq compilation-error-screen-columns nil)
- (- (match-beginning 4) (match-end 1)))
- .
- (lambda () (- (match-end 5) (match-end 1)
- (- (match-end 4) (match-beginning 4)))))
- nil 1)
("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
"Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
@@ -709,6 +715,8 @@
(set (make-local-variable 'compilation-process-setup-function)
'grep-process-setup)
(set (make-local-variable 'compilation-disable-input) t)
+ (set (make-local-variable 'compilation-error-screen-columns)
+ grep-error-screen-columns)
(add-hook 'compilation-filter-hook 'grep-filter nil t))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105677: * lisp/progmodes/grep.el (grep-regexp-alist): Calculate column positions,
Juri Linkov <=