]> git.eshelyaron.com Git - emacs.git/commitdiff
(occur-next-error): Call set-window-point.
authorRichard M. Stallman <rms@gnu.org>
Sat, 24 Jul 2004 21:34:47 +0000 (21:34 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 24 Jul 2004 21:34:47 +0000 (21:34 +0000)
(occur-engine): Handle negative NLINES.

lisp/replace.el

index f81c6f539147011240682aa2f01f7c5d892967e9..f09868cc6d3b7632bd949bddc49199f717c32485 100644 (file)
@@ -732,6 +732,8 @@ Compatibility function for \\[next-error] invocations."
        #'previous-single-property-change
      #'next-single-property-change)
    "No more matches")
+  ;; In case the *Occur* buffer is visible in a nonselected window.
+  (set-window-point (get-buffer-window (current-buffer)) (point))
   (occur-mode-goto-occurrence))
 
 \f
@@ -1009,9 +1011,11 @@ See also `multi-occur'."
                              ;; concatenate them all together.
                              (apply #'concat
                                     (nconc
-                                     (occur-engine-add-prefix (nreverse (cdr (occur-accumulate-lines (- (1+ nlines)) keep-props))))
+                                     (occur-engine-add-prefix (nreverse (cdr (occur-accumulate-lines (- (1+ (abs nlines))) keep-props))))
                                      (list out-line)
-                                     (occur-engine-add-prefix (cdr (occur-accumulate-lines (1+ nlines) keep-props))))))))
+                                     (if (> nlines 0)
+                                         (occur-engine-add-prefix
+                                          (cdr (occur-accumulate-lines (1+ nlines) keep-props)))))))))
                      ;; Actually insert the match display data
                      (with-current-buffer out-buf
                        (let ((beg (point))