unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Juri Linkov'" <juri@jurta.org>, "'martin rudalics'" <rudalics@gmx.at>
Cc: 12253@debbugs.gnu.org
Subject: bug#12253: Restore window start position
Date: Wed, 16 Jan 2013 08:57:18 -0800	[thread overview]
Message-ID: <FAD5C9CE56B7466884A68C3BF3DAC5C0@us.oracle.com> (raw)
In-Reply-To: <87r4qun7u1.fsf@mail.jurta.org>

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

The attached patch seems to fix the Isearch problem generally, restoring the
original position of point within the window.

[-- Attachment #2: isearch-2011-05-16.patch --]
[-- Type: application/octet-stream, Size: 1968 bytes --]

diff -cw isearch.el isearch-patched-2011-05-16.el
*** isearch.el	Mon May 16 11:38:22 2011
--- isearch-patched-2011-05-16.el	Mon May 16 14:21:04 2011
***************
*** 1060,1065 ****
--- 1060,1080 ----
  
  (defvar minibuffer-history-symbol) ;; from external package gmhist.el
  
+ (defun isearch-fail-pos ()
+   "Position of first mismatch in search string, or its length if none."
+   (let ((cmds  isearch-cmds)
+         succ-msg)
+     (if (and isearch-success (not isearch-error))
+         (length isearch-message)
+       (while (or (not (isearch-success-state (car cmds)))
+                  (isearch-error-state (car cmds)))
+         (pop cmds))
+       (setq succ-msg  (and cmds (isearch-message-state (car cmds))))
+       (if (and (stringp succ-msg)  (< (length succ-msg) (length isearch-message))
+                (equal succ-msg (substring isearch-message 0 (length succ-msg))))
+           (length succ-msg)
+         0))))
+ 
  (defun isearch-edit-string ()
    "Edit the search string in the minibuffer.
  The following additional command keys are active while editing.
***************
*** 1139,1145 ****
  		(setq isearch-new-string
                        (read-from-minibuffer
                         (isearch-message-prefix nil nil isearch-nonincremental)
!                        isearch-string
                         minibuffer-local-isearch-map nil
                         (if isearch-regexp
  			   (cons 'regexp-search-ring
--- 1154,1160 ----
                   (setq isearch-new-string
                         (read-from-minibuffer
                          (isearch-message-prefix nil nil isearch-nonincremental)
!                         (cons isearch-string (1+ (isearch-fail-pos)))
                          minibuffer-local-isearch-map nil
                          (if isearch-regexp
                              (cons 'regexp-search-ring

Diff finished.  Mon May 16 14:23:06 2011

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

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21 22:17 bug#12253: Restore window start position Juri Linkov
2012-08-22  7:08 ` martin rudalics
2012-08-22 23:38   ` Juri Linkov
2012-08-23  8:48     ` martin rudalics
2012-08-23 22:00       ` Juri Linkov
2012-08-24  9:45         ` martin rudalics
2012-08-25  0:29           ` Juri Linkov
2012-08-25 13:40             ` martin rudalics
2012-08-25 19:29               ` Juri Linkov
2012-08-28  8:53                 ` Juri Linkov
2013-01-16 16:57                 ` Drew Adams [this message]
2013-01-18 22:42                   ` Drew Adams
2013-01-19 10:17                     ` Juri Linkov
2013-01-19 15:03                       ` Drew Adams
2013-03-29 16:56                         ` Drew Adams
2021-05-11 14:33                           ` Drew Adams
2021-05-11 17:53                             ` Juri Linkov
2021-05-11 18:46                               ` bug#12253: [External] : " Drew Adams
2021-05-11 19:29                                 ` Juri Linkov
2021-05-11 20:18                                   ` Drew Adams
2021-05-12  8:47                                   ` martin rudalics
2024-01-10 11:31                                     ` Stefan Kangas
2024-01-10 17:16                                       ` 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=FAD5C9CE56B7466884A68C3BF3DAC5C0@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=12253@debbugs.gnu.org \
    --cc=juri@jurta.org \
    --cc=rudalics@gmx.at \
    /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).