From: Juri Linkov Date: Tue, 30 Mar 2010 15:44:50 +0000 (+0300) Subject: * replace.el (occur-accumulate-lines): Fix a bug where the first X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~631 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=47c88c067f98772d5b505d7b6ad3d0909da5f68a;p=emacs.git * replace.el (occur-accumulate-lines): Fix a bug where the first context line at the beginning of the buffer was missing. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 289bc012bdf..6ef607e8025 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-03-30 Juri Linkov + + * replace.el (occur-accumulate-lines): Fix a bug where the first + context line at the beginning of the buffer was missing. + 2010-03-30 Eli Zaretskii * files.el: Make bidi-display-reordering safe variable for boolean 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." (defun occur-accumulate-lines (count &optional keep-props) (save-excursion (let ((forwardp (> count 0)) - result beg end) + result beg end moved) (while (not (or (zerop count) (if forwardp (eobp) - (bobp)))) + (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) - (forward-line (if forwardp 1 -1))) + (setq moved (= 0 (forward-line (if forwardp 1 -1))))) (nreverse result)))) (defun occur-read-primary-args () @@ -1028,7 +1028,7 @@ which means to discard all text properties." (defun occur-rename-buffer (&optional unique-p interactive-p) "Rename the current *Occur* buffer to *Occur: original-buffer-name*. -Here `original-buffer-name' is the buffer name were Occur was originally run. +Here `original-buffer-name' is the buffer name where Occur was originally run. When given the prefix argument, or called non-interactively, the renaming will not clobber the existing buffer(s) of that name, but use `generate-new-buffer-name' instead. You can add this to `occur-hook'