only one match per line
Stefan Bund [Tue, 13 Sep 2011 11:15:14 +0000 (13:15 +0200)]
egrep.el

index 8096b57..1bab9fe 100644 (file)
--- a/egrep.el
+++ b/egrep.el
                   (column (current-column))
                   (text (buffer-substring (save-excursion (beginning-of-line) (point))
                                           (save-excursion (end-of-line) (point)))))
-            (with-current-buffer result-buffer
-              (let ((inhibit-read-only t))
-                (insert (format "%s:%d:%d: %s\n"
-                                (dired-make-relative file-name default-directory)
-                                line column text))))))))))
+              (with-current-buffer result-buffer
+                (let ((inhibit-read-only t))
+                  (insert (format "%s:%d:%d: %s\n"
+                                  (dired-make-relative file-name default-directory)
+                                  line column text))))
+              ; only one match / line
+              (forward-line 1)))))))
 
 (defun egrep-prepare-result-buffer ()
   (let ((result-buffer (get-buffer-create "*egrep*")))