emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/replace.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el,v
Date: Thu, 03 Jan 2008 09:51:52 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       08/01/03 09:51:52

Index: replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -b -r1.265 -r1.266
--- replace.el  28 Dec 2007 22:26:08 -0000      1.265
+++ replace.el  3 Jan 2008 09:51:52 -0000       1.266
@@ -1246,16 +1246,9 @@
                            (if (= nlines 0)
                                ;; The simple display style
                                out-line
-                             ;; The complex multi-line display
-                             ;; style.  Generate a list of lines,
-                             ;; concatenate them all together.
-                             (apply #'concat
-                                    (nconc
-                                     (occur-engine-add-prefix (nreverse (cdr 
(occur-accumulate-lines (- (1+ (abs nlines))) keep-props))))
-                                     (list out-line)
-                                     (if (> nlines 0)
-                                         (occur-engine-add-prefix
-                                          (cdr (occur-accumulate-lines (1+ 
nlines) keep-props)))))))))
+                             ;; The complex multi-line display style.
+                             (occur-context-lines out-line nlines keep-props)
+                             )))
                      ;; Actually insert the match display data
                      (with-current-buffer out-buf
                        (let ((beg (point))
@@ -1293,6 +1286,21 @@
       ;; Return the number of matches
       globalcount)))
 
+;; Generate context display for occur.
+;; OUT-LINE is the line where the match is.
+;; NLINES and KEEP-PROPS are args to occur-engine.
+;; Generate a list of lines, add prefixes to all but OUT-LINE,
+;; then concatenate them all together.
+(defun occur-context-lines (out-line nlines keep-props)
+  (apply #'concat
+        (nconc
+         (occur-engine-add-prefix
+          (nreverse (cdr (occur-accumulate-lines
+                          (- (1+ (abs nlines))) keep-props))))
+         (list out-line)
+         (if (> nlines 0)
+             (occur-engine-add-prefix
+              (cdr (occur-accumulate-lines (1+ nlines) keep-props)))))))
 
 ;; It would be nice to use \\[...], but there is no reasonable way
 ;; to make that display both SPC and Y.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]