aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJuri Linkov2010-03-30 18:44:50 +0300
committerJuri Linkov2010-03-30 18:44:50 +0300
commit47c88c067f98772d5b505d7b6ad3d0909da5f68a (patch)
tree8c2518b375d2b249da3e731887491fa1db90e842 /lisp/replace.el
parent3580374b8abcb7d174fcde563ac6298e741f63b2 (diff)
downloademacs-47c88c067f98772d5b505d7b6ad3d0909da5f68a.tar.gz
emacs-47c88c067f98772d5b505d7b6ad3d0909da5f68a.zip
* replace.el (occur-accumulate-lines): Fix a bug where the first
context line at the beginning of the buffer was missing.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 4a8b39dbca7..a74da4b89b5 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1008,16 +1008,16 @@ which means to discard all text properties."
1008(defun occur-accumulate-lines (count &optional keep-props) 1008(defun occur-accumulate-lines (count &optional keep-props)
1009 (save-excursion 1009 (save-excursion
1010 (let ((forwardp (> count 0)) 1010 (let ((forwardp (> count 0))
1011 result beg end) 1011 result beg end moved)
1012 (while (not (or (zerop count) 1012 (while (not (or (zerop count)
1013 (if forwardp 1013 (if forwardp
1014 (eobp) 1014 (eobp)
1015 (bobp)))) 1015 (and (bobp) (not moved)))))
1016 (setq count (+ count (if forwardp -1 1))) 1016 (setq count (+ count (if forwardp -1 1)))
1017 (setq beg (line-beginning-position) 1017 (setq beg (line-beginning-position)
1018 end (line-end-position)) 1018 end (line-end-position))
1019 (push (occur-engine-line beg end keep-props) result) 1019 (push (occur-engine-line beg end keep-props) result)
1020 (forward-line (if forwardp 1 -1))) 1020 (setq moved (= 0 (forward-line (if forwardp 1 -1)))))
1021 (nreverse result)))) 1021 (nreverse result))))
1022 1022
1023(defun occur-read-primary-args () 1023(defun occur-read-primary-args ()
@@ -1028,7 +1028,7 @@ which means to discard all text properties."
1028 1028
1029(defun occur-rename-buffer (&optional unique-p interactive-p) 1029(defun occur-rename-buffer (&optional unique-p interactive-p)
1030 "Rename the current *Occur* buffer to *Occur: original-buffer-name*. 1030 "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
1031Here `original-buffer-name' is the buffer name were Occur was originally run. 1031Here `original-buffer-name' is the buffer name where Occur was originally run.
1032When given the prefix argument, or called non-interactively, the renaming 1032When given the prefix argument, or called non-interactively, the renaming
1033will not clobber the existing buffer(s) of that name, but use 1033will not clobber the existing buffer(s) of that name, but use
1034`generate-new-buffer-name' instead. You can add this to `occur-hook' 1034`generate-new-buffer-name' instead. You can add this to `occur-hook'