fix predicate point position
[emacs-egrep.git] / egrep.el
index b143979..0b943a0 100644 (file)
--- a/egrep.el
+++ b/egrep.el
@@ -6,7 +6,8 @@
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward regexp nil t)
-        (if (or (not predicate) (apply predicate args))
+        (if (or (not predicate) (save-excursion (goto-char (match-beginning 0))
+                                                (apply predicate args)))
             (let ((line (count-lines (point-min) (point)))
                   (column (current-column))
                   (text (buffer-substring (save-excursion (beginning-of-line) (point))