aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-16 03:56:40 +0000
committerRichard M. Stallman2001-12-16 03:56:40 +0000
commitddbe3d5ff3c3fcd4a74b51ab6a8ced289306936a (patch)
treebf6b04478c3c15ab4947905f55a9892c08a2d198
parent88715f05a1a6c48324adc199d710f670071d441f (diff)
downloademacs-ddbe3d5ff3c3fcd4a74b51ab6a8ced289306936a.tar.gz
emacs-ddbe3d5ff3c3fcd4a74b51ab6a8ced289306936a.zip
(isearch-start-hscroll): New variable.
(isearch-mode): Set isearch-start-hscroll. (isearch-update): Restore original hscrolling if possible.
-rw-r--r--lisp/isearch.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index f3023b82c1a..82d3d781d02 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -366,6 +366,7 @@ Default value, nil, means edit the string instead."
366(defvar isearch-wrapped nil) ; Searching restarted from the top (bottom). 366(defvar isearch-wrapped nil) ; Searching restarted from the top (bottom).
367(defvar isearch-barrier 0) 367(defvar isearch-barrier 0)
368(defvar isearch-just-started nil) 368(defvar isearch-just-started nil)
369(defvar isearch-start-hscroll 0) ; hscroll when starting the search.
369 370
370; case-fold-search while searching. 371; case-fold-search while searching.
371; either nil, t, or 'yes. 'yes means the same as t except that mixed 372; either nil, t, or 'yes. 'yes means the same as t except that mixed
@@ -557,6 +558,7 @@ is treated as a regexp. See \\[isearch-forward] for more info."
557 isearch-other-end nil 558 isearch-other-end nil
558 isearch-small-window nil 559 isearch-small-window nil
559 isearch-just-started t 560 isearch-just-started t
561 isearch-start-hscroll (window-hscroll)
560 562
561 isearch-opoint (point) 563 isearch-opoint (point)
562 search-ring-yank-pointer nil 564 search-ring-yank-pointer nil
@@ -636,8 +638,13 @@ is treated as a regexp. See \\[isearch-forward] for more info."
636 (window-hscroll)) 638 (window-hscroll))
637 (set-window-hscroll (selected-window) 0)) 639 (set-window-hscroll (selected-window) 0))
638 (other-window 1)) 640 (other-window 1))
639 (goto-char found-point))) 641 (goto-char found-point))
640 (if isearch-other-end 642 ;; Keep same hscrolling as at the start of the search when possible
643 (let ((current-scroll (window-hscroll)))
644 (set-window-hscroll (selected-window) isearch-start-hscroll)
645 (unless (pos-visible-in-window-p)
646 (set-window-hscroll (selected-window) current-scroll))))
647 (if isearch-other-end
641 (if (< isearch-other-end (point)) ; isearch-forward? 648 (if (< isearch-other-end (point)) ; isearch-forward?
642 (isearch-highlight isearch-other-end (point)) 649 (isearch-highlight isearch-other-end (point))
643 (isearch-highlight (point) isearch-other-end)) 650 (isearch-highlight (point) isearch-other-end))