[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99779: * replace.el (occur-accumulat
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99779: * replace.el (occur-accumulate-lines): Move occur-engine related |
Date: |
Tue, 30 Mar 2010 19:38:45 +0300 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 99779
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-30 19:38:45 +0300
message:
* replace.el (occur-accumulate-lines): Move occur-engine related
functions `occur-accumulate-lines' and `occur-engine-add-prefix'
to be located after `occur-engine'.
modified:
lisp/ChangeLog
lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-03-30 16:10:14 +0000
+++ b/lisp/ChangeLog 2010-03-30 16:38:45 +0000
@@ -4,6 +4,12 @@
2010-03-30 Juri Linkov <address@hidden>
+ * replace.el (occur-accumulate-lines): Move occur-engine related
+ functions `occur-accumulate-lines' and `occur-engine-add-prefix'
+ to be located after `occur-engine'.
+
+2010-03-30 Juri Linkov <address@hidden>
+
Make occur handle multi-line matches cleanly with context.
http://lists.gnu.org/archive/html/emacs-devel/2010-03/msg01280.html
=== modified file 'lisp/replace.el'
--- a/lisp/replace.el 2010-03-30 16:03:08 +0000
+++ b/lisp/replace.el 2010-03-30 16:38:45 +0000
@@ -1005,23 +1005,6 @@
:group 'matching
:version "22.1")
-(defun occur-accumulate-lines (count &optional keep-props pt)
- (save-excursion
- (when pt
- (goto-char pt))
- (let ((forwardp (> count 0))
- result beg end moved)
- (while (not (or (zerop count)
- (if forwardp
- (eobp)
- (and (bobp) (not moved)))))
- (setq count (+ count (if forwardp -1 1)))
- (setq beg (line-beginning-position)
- end (line-end-position))
- (push (occur-engine-line beg end keep-props) result)
- (setq moved (= 0 (forward-line (if forwardp 1 -1)))))
- (nreverse result))))
-
(defun occur-read-primary-args ()
(list (read-regexp "List lines matching regexp"
(car regexp-history))
@@ -1175,12 +1158,6 @@
(set-buffer-modified-p nil)
(run-hooks 'occur-hook)))))))
-(defun occur-engine-add-prefix (lines)
- (mapcar
- #'(lambda (line)
- (concat " :" line "\n"))
- lines))
-
(defun occur-engine (regexp buffers out-buf nlines case-fold-search
title-face prefix-face match-face keep-props)
(with-current-buffer out-buf
@@ -1356,6 +1333,29 @@
str)
(buffer-substring-no-properties beg end)))
+(defun occur-engine-add-prefix (lines)
+ (mapcar
+ #'(lambda (line)
+ (concat " :" line "\n"))
+ lines))
+
+(defun occur-accumulate-lines (count &optional keep-props pt)
+ (save-excursion
+ (when pt
+ (goto-char pt))
+ (let ((forwardp (> count 0))
+ result beg end moved)
+ (while (not (or (zerop count)
+ (if forwardp
+ (eobp)
+ (and (bobp) (not moved)))))
+ (setq count (+ count (if forwardp -1 1)))
+ (setq beg (line-beginning-position)
+ end (line-end-position))
+ (push (occur-engine-line beg end keep-props) result)
+ (setq moved (= 0 (forward-line (if forwardp 1 -1)))))
+ (nreverse result))))
+
;; Generate context display for occur.
;; OUT-LINE is the line where the match is.
;; NLINES and KEEP-PROPS are args to occur-engine.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99779: * replace.el (occur-accumulate-lines): Move occur-engine related,
Juri Linkov <=