From: "Drew Adams" <drew.adams@oracle.com>
To: "'Eli Zaretskii'" <eliz@gnu.org>
Cc: emacs-devel@gnu.org, dmoncayo@gmail.com
Subject: RE: Should ending successful Isearch with C-g restore the relative window position?
Date: Tue, 15 Jan 2013 14:04:53 -0800 [thread overview]
Message-ID: <B397C20CB54F409CBE7CB74C5024B8BB@us.oracle.com> (raw)
In-Reply-To: <83zk0ape2h.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]
> > Thanks for the explanation. So it sounds like this is not
> > an enhancement we can expect anytime soon.
>
> Depends on the availability of motivated volunteers ;-)
Well I'm certainly no expert here. And I believe you when you say that it will
be difficult to fix this adequately.
I took a quick stab at it anyway. Please try the attached patch, as a first
attempt. It does not provide for the new behavior to be optional - dunno
whether that is needed.
I did not check the many possible Isearch code paths and use cases. I just
checked it quickly. So far, it seems to DTRT for the few things I tried.
If this happens to actually be TRT, great. But the change I made is trivial, so
I assume there must be more to it, to DTRT in all cases.
I hope that passing this along might allow someone to enlighten me further or
perhaps encourage someone to provide a more complete solution.
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'.
HTH.
[-- Attachment #2: isearch-2013-01-15.patch --]
[-- Type: application/octet-stream, Size: 1852 bytes --]
diff -c isearch-patched-2013-01-15.el isearch.el
*** isearch-patched-2013-01-15.el Tue Jan 15 13:54:02 2013
--- isearch.el Tue Jan 15 13:49:58 2013
***************
*** 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)
--- 605,610 ----
***************
*** 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
--- 827,832 ----
***************
*** 1312,1319 ****
;; 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)
! (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.
--- 1308,1314 ----
;; 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.
Diff finished. Tue Jan 15 20:54:28 2013
next prev parent reply other threads:[~2013-01-15 22:04 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 [this message]
2013-01-16 16:55 ` Should ending successful Isearch with C-g restore therelative " Drew Adams
2013-01-16 21:29 ` Should ending successful Isearch with C-g restore the relative " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B397C20CB54F409CBE7CB74C5024B8BB@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.