Article View: gnu.emacs.bug
Article #98754Re: isearch not always setting mark on exit
From: Julian Cowley
Date: Fri, 05 Apr 1991 10:26
Date: Fri, 05 Apr 1991 10:26
53 lines
3365 bytes
3365 bytes
In gnu.emacs.bug I wrote:
>Something that has always bothered me about the isearch commands
>is that they doesn't always set the mark upon exit using ESC (or
>any other control char, for that matter). While I haven't delved
>into this by more than casual observation, it does seem that they
>set the mark the first couple of times, then stop from then on.
>Has anyone else noticed this? I have no idea what could be
>causing this behavior, so any help would be appreciated.
I found out what the problem is. It turns out that that isearch
only sets the mark when it doesn't change windows during the
search; that is, if search-slow-speed causes a small window to be
displayed, the mark won't be set. The reason is that a
save-window-excursion encloses the actual search and causes a
different value for point to be restored depending on whether the
search ends in the current window or the small window. If it is
the current window, point stays at the searched text; if it is
the small window, then point moves back to where it was when the
search began (or to where it was in the current window when the
small window was created, I gather). In both cases, the actual
search end point is stored temporarily in found-point, but the
test whether set the mark or not uses the value of point instead.
This is not necessarily where the search ended, hence the odd
behavior.
At least that's what I believe is happening :-). I'm including a
patch here for the problem (only one line!), but I'm only about
90% sure that it is correct. That judgement should be left to
someone who has intimate knowledge of how the isearch commands
work (or more importantly, save-window-excursion). However, I've
been using the patch, and it seems to work fine.
Thanks to cjross@bbn.com for the definite diagnosis to the
problem.
Julian Cowley / U. of Hawaii at Manoa | "God is love." -- John, c. 60 A. D.
julian@uhunix.uhcc.hawaii.edu | "All you need is love." -- John, 1967
*** /usr/uh/src/gnu/emacs/dist-18.55/lisp/isearch.el Tue Dec 8 13:11:03 1987
--- isearch.el Thu Apr 4 23:15:47 1991
***************
*** 255,259 ****
;; If there was movement, mark the starting position.
;; Maybe should test difference between and set mark iff > threshold.
! (if (/= (point) opoint)
(push-mark opoint)
(message ""))
--- 255,259 ----
;; If there was movement, mark the starting position.
;; Maybe should test difference between and set mark iff > threshold.
! (if (/= found-point opoint)
(push-mark opoint)
(message ""))
Technical Details
Message-ID:
<9104051026.AA16756@uhunix.uhcc.Hawaii.Edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!emory!swrinde!zaphod.mps.ohio-state.edu!usc!apple!agate!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbageReferences:
<9104012049.AA03174@uhunix.uhcc.Hawaii.Edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,656268d7c211744,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-04-06 02:13:01 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!emory!swrinde!zaphod.mps.ohio-state.edu!usc!apple!agate!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage From: julian@UHUNIX.UHCC.HAWAII.EDU (Julian Cowley) Newsgroups: gnu.emacs.bug Subject: Re: isearch not always setting mark on exit Message-ID: <9104051026.AA16756@uhunix.uhcc.Hawaii.Edu> Date: 5 Apr 91 10:26:29 GMT References: <9104012049.AA03174@uhunix.uhcc.Hawaii.Edu> Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 53 Approved: bug-gnu-emacs@prep.ai.mit.edu