[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should ending successful Isearch with C-g restore the relative windo
From: |
Juri Linkov |
Subject: |
Re: Should ending successful Isearch with C-g restore the relative window position? |
Date: |
Wed, 16 Jan 2013 23:29:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
> That patch did not fix the problem when searching across Info nodes.
A more general approach would be to save the window start position on
the stack and restore it in `isearch-cancel' like the patch below does.
`isearch-done' already does something like this by restoring
the original window configuration with `set-window-configuration'
from `isearch-window-configuration'. But it does this only
on slow terminals where baud-rate is less than 1200. So perhaps
this patch will also make `isearch-window-configuration' obsolete.
The remaining problem is how to take into account the case
when `isearch-allow-scroll' is non-nil and the user scrolled the
window-start to another position. We should find the right place
to update the window-start of the previous state on the search stack
to be able to restore it later.
=== modified file 'lisp/isearch.el'
--- lisp/isearch.el 2013-01-02 16:13:04 +0000
+++ lisp/isearch.el 2013-01-16 21:28:52 +0000
@@ -1036,6 +1036,7 @@ (cl-defstruct (isearch--state
(string isearch-string)
(message isearch-message)
(point (point))
+ (window-start (window-start))
(success isearch-success)
(forward isearch-forward)
(other-end isearch-other-end)
@@ -1049,6 +1050,7 @@ (cl-defstruct (isearch--state
(string :read-only t)
(message :read-only t)
(point :read-only t)
+ (window-start :read-only t)
(success :read-only t)
(forward :read-only t)
(other-end :read-only t)
@@ -1072,7 +1074,9 @@ (defun isearch--set-state (cmd)
isearch-case-fold-search (isearch--state-case-fold-search cmd))
(if (functionp (isearch--state-pop-fun cmd))
(funcall (isearch--state-pop-fun cmd) cmd))
- (goto-char (isearch--state-point cmd)))
+ (goto-char (isearch--state-point cmd))
+ (unless (eq (isearch--state-window-start cmd) (window-start))
+ (set-window-start nil (isearch--state-window-start cmd))))
(defun isearch-pop-state ()
(setq isearch-cmds (cdr isearch-cmds))
@@ -1303,12 +1307,8 @@ (defun isearch-reverse-exit-minibuffer (
(defun isearch-cancel ()
"Terminate the search and go back to the starting point."
(interactive)
- (if (and isearch-push-state-function isearch-cmds)
- ;; For defined push-state function, restore the first state.
- ;; This calls pop-state function and restores original point.
- (let ((isearch-cmds (last isearch-cmds)))
- (isearch--set-state (car isearch-cmds)))
- (goto-char isearch-opoint))
+ (let ((isearch-cmds (last isearch-cmds)))
+ (isearch--set-state (car isearch-cmds)))
(isearch-done t) ; Exit isearch..
(isearch-clean-overlays)
(signal 'quit nil)) ; ..and pass on quit signal.
@@ -2646,7 +2646,9 @@ (defun isearch-search ()
(if (functionp (isearch--state-pop-fun (car isearch-cmds)))
(funcall (isearch--state-pop-fun (car isearch-cmds))
(car isearch-cmds)))
- (goto-char (isearch--state-point (car isearch-cmds)))))
+ (goto-char (isearch--state-point (car isearch-cmds)))
+ (unless (eq (isearch--state-window-start (car isearch-cmds))
(window-start))
+ (set-window-start nil (isearch--state-window-start (car
isearch-cmds))))))
- RE: Should ending successful Isearch with C-g restore the relativewindow position?, (continued)
- Re: Should ending successful Isearch with C-g restore the relative window position?, Eli Zaretskii, 2013/01/15
- RE: Should ending successful Isearch with C-g restore the relative window position?, Drew Adams, 2013/01/15
- Re: Should ending successful Isearch with C-g restore the relative window position?, Eli Zaretskii, 2013/01/15
- RE: Should ending successful Isearch with C-g restore the relative window position?, Drew Adams, 2013/01/15
- Re: Should ending successful Isearch with C-g restore the relative window position?, Eli Zaretskii, 2013/01/15
- RE: Should ending successful Isearch with C-g restore the relative window position?, Drew Adams, 2013/01/15
- RE: Should ending successful Isearch with C-g restore therelative window position?, Drew Adams, 2013/01/16
- Re: Should ending successful Isearch with C-g restore the relative window position?,
Juri Linkov <=
- RE: Should ending successful Isearch with C-g restore the relative window position?, Drew Adams, 2013/01/16
- Re: Should ending successful Isearch with C-g restore the relative window position?, Juri Linkov, 2013/01/17
Re: Should ending successful Isearch with C-g restore the relative window position?, Juri Linkov, 2013/01/15