unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Eli Zaretskii'" <eliz@gnu.org>
Cc: dmoncayo@gmail.com, emacs-devel@gnu.org
Subject: RE: Should ending successful Isearch with C-g restore therelative	window position?
Date: Wed, 16 Jan 2013 08:55:10 -0800	[thread overview]
Message-ID: <3F79EED6372147F5AAC4F6EC7A02A18E@us.oracle.com> (raw)
In-Reply-To: <B397C20CB54F409CBE7CB74C5024B8BB@us.oracle.com>

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

> All I did was this:
> 
> 1. Save the relative window line number of point, before searching, in
> `isearch-mode'.
> 
> 2. Restore that, in `isearch-cancel'.

That patch did not fix the problem when searching across Info nodes.
The attached patch does.  AFAICT, it works generally.

[-- Attachment #2: isearch-2013-01-16.patch --]
[-- Type: application/octet-stream, Size: 2061 bytes --]

diff -c isearch.el isearch-patched-2013-01-16.el
*** isearch.el	Wed Jan 16 08:49:58 2013
--- isearch-patched-2013-01-16.el	Wed Jan 16 08:51:10 2013
***************
*** 605,610 ****
--- 605,612 ----
  (defvar isearch-opoint 0)
  ;; The window configuration active at the beginning of the search.
  (defvar isearch-window-configuration nil)
+ ;; The line number of point before searching, relative to the line number of `window-start'.
+ (defvar isearch-win-pt-line nil)
  
  ;; Flag to indicate a yank occurred, so don't move the cursor.
  (defvar isearch-yank-flag nil)
***************
*** 827,832 ****
--- 829,836 ----
  	isearch-start-hscroll (window-hscroll)
  
  	isearch-opoint (point)
+         isearch-win-pt-line (- (line-number-at-pos)
+                                (line-number-at-pos (window-start)))
  	search-ring-yank-pointer nil
  	isearch-opened-overlays nil
  	isearch-input-method-function input-method-function
***************
*** 1307,1314 ****
        ;; 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))
    (isearch-done t)                      ; Exit isearch..
    (isearch-clean-overlays)
    (signal 'quit nil))                   ; ..and pass on quit signal.
--- 1311,1320 ----
        ;; 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))
!         (when isearch-win-pt-line (recenter isearch-win-pt-line)))
!     (goto-char isearch-opoint)
!     (when isearch-win-pt-line (recenter isearch-win-pt-line)))
    (isearch-done t)                      ; Exit isearch..
    (isearch-clean-overlays)
    (signal 'quit nil))                   ; ..and pass on quit signal.

Diff finished.  Wed Jan 16 15:52:01 2013

  reply	other threads:[~2013-01-16 16:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 22:29 Should ending successful Isearch with C-g restore the relative window position? Drew Adams
2013-01-14 23:07 ` Dani Moncayo
2013-01-14 23:17   ` Drew Adams
2013-01-15  3:49     ` Eli Zaretskii
2013-01-15 14:58       ` Drew Adams
2013-01-15 15:09         ` Alan Mackenzie
2013-01-15 16:22           ` Should ending successful Isearch with C-g restore the relativewindow position? Drew Adams
2013-01-15 16:36             ` Alan Mackenzie
2013-01-15 16:54               ` Should ending successful Isearch with C-g restore therelativewindow position? Drew Adams
2013-01-15 16:34         ` Should ending successful Isearch with C-g restore the relative window position? Eli Zaretskii
2013-01-15 16:58           ` Drew Adams
2013-01-15 17:10             ` Eli Zaretskii
2013-01-15 17:59               ` Drew Adams
2013-01-15 18:25                 ` Eli Zaretskii
2013-01-15 22:04               ` Drew Adams
2013-01-16 16:55                 ` Drew Adams [this message]
2013-01-16 21:29                   ` Juri Linkov
2013-01-16 22:16                     ` Drew Adams
2013-01-17 21:35                       ` Juri Linkov
2013-01-15  9:52   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F79EED6372147F5AAC4F6EC7A02A18E@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=dmoncayo@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).