Mercurial > emacs
diff lisp/replace.el @ 91327:606f2d163a64
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-312
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 09 Jan 2008 01:21:15 +0000 |
parents | 56a72e2bd635 107ccd98fa12 |
children | c70e45a7acfd |
line wrap: on
line diff
--- a/lisp/replace.el Tue Jan 08 05:34:24 2008 +0000 +++ b/lisp/replace.el Wed Jan 09 01:21:15 2008 +0000 @@ -1,7 +1,7 @@ ;;; replace.el --- replace commands for Emacs ;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1996, 1997, 2000, 2001, -;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. ;; Maintainer: FSF @@ -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.