unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Search Next
@ 2002-12-09 15:39 CarlC
  2002-12-09 15:52 ` Galen Boyer
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: CarlC @ 2002-12-09 15:39 UTC (permalink / raw)


I am having trouble finding the emacs command for Find Next. Basically, I
want to be able to press a key and have it search for the next occurrence of
the previously entered search string. I know that I can do CTRL-S while in
isearch and it will move to the next occurence. I want to do this after
exiting isearch.

On a related subject, what is the name of the variable that stores this last
search string? I want to be able to save this for each file from session.el.

Thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-09 15:39 Search Next CarlC
@ 2002-12-09 15:52 ` Galen Boyer
       [not found]   ` <KI4J9.122660$Gc.3983550@twister.austin.rr.com>
  2002-12-10 11:15 ` ken
  2002-12-12 15:23 ` Benjamin Riefenstahl
  2 siblings, 1 reply; 12+ messages in thread
From: Galen Boyer @ 2002-12-09 15:52 UTC (permalink / raw)


On Mon, 09 Dec 2002, carlc@snowbd.com wrote:
> I am having trouble finding the emacs command for Find
> Next. Basically, I want to be able to press a key and have it
> search for the next occurrence of the previously entered search
> string. I know that I can do CTRL-S while in isearch and it
> will move to the next occurence. I want to do this after
> exiting isearch.

Why can't you do C-s C-s again?  It will keep your last search as
the default for the next one, and you can do M-p to get other
searches.


> On a related subject, what is the name of the variable that
> stores this last search string? I want to be able to save this
> for each file from session.el.

isearch-string
-- 
Galen Boyer

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
       [not found]   ` <KI4J9.122660$Gc.3983550@twister.austin.rr.com>
@ 2002-12-09 21:16     ` Kevin Rodgers
  2002-12-10  8:49     ` Kai Großjohann
  1 sibling, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2002-12-09 21:16 UTC (permalink / raw)


CarlC wrote:

> "Galen Boyer" <galenboyer@hotpop.com> wrote in message
> news:usmx7jiq2.fsf@standardandpoors.com...
>>Why can't you do C-s C-s again?  It will keep your last search as
>>the default for the next one, and you can do M-p to get other
>>searches.
> 
> This works fine. Can I bind it to a function key?


Of course:


(global-set-key [f5] "\C-s\C-s")	; keyboard macro


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
       [not found]   ` <KI4J9.122660$Gc.3983550@twister.austin.rr.com>
  2002-12-09 21:16     ` Kevin Rodgers
@ 2002-12-10  8:49     ` Kai Großjohann
  2002-12-10 14:10       ` CarlC
  1 sibling, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 2002-12-10  8:49 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> session stores search-ring as a global list of search strings. C-s
> C-s works from the last string in this global list. I want to
> remember the last search string for the individual file.

Sounds like an interesting feature, but I don't think Emacs has it.
Hm.  I can't find the variable that would hold the history for
isearch.

What happens if you do M-: (make-local-variable 'isearch-string) RET
in a buffer?  Then C-s C-s in that buffer should remember the last
search from that buffer, instead of the last search in any buffer.

If you really want that for all buffers, then (require 'isearch) and
then (make-variable-buffer-local 'isearch-string) might be an
incantation to add to .emacs.

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-09 15:39 Search Next CarlC
  2002-12-09 15:52 ` Galen Boyer
@ 2002-12-10 11:15 ` ken
  2002-12-12 15:23 ` Benjamin Riefenstahl
  2 siblings, 0 replies; 12+ messages in thread
From: ken @ 2002-12-10 11:15 UTC (permalink / raw)
  Cc: help-gnu-emacs


The first C-s will prompt for the search string.  If you respond to this 
with another C-s, it will use the previously entered search string.  
That is, all you have to do is do C-s twice.

ken

CarlC at 15:39 (UTC-0000) on Mon, 9 Dec 2002 said:

= I am having trouble finding the emacs command for Find Next. Basically, I
= want to be able to press a key and have it search for the next occurrence of
= the previously entered search string. I know that I can do CTRL-S while in
= isearch and it will move to the next occurence. I want to do this after
= exiting isearch.
= 
= On a related subject, what is the name of the variable that stores this last
= search string? I want to be able to save this for each file from session.el.
= 
= Thanks.
= 
= 
= _______________________________________________
= Help-gnu-emacs mailing list
= Help-gnu-emacs@gnu.org
= http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
= 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-10  8:49     ` Kai Großjohann
@ 2002-12-10 14:10       ` CarlC
  2002-12-10 18:06         ` Kai Großjohann
  2002-12-13 23:21         ` Alan Mackenzie
  0 siblings, 2 replies; 12+ messages in thread
From: CarlC @ 2002-12-10 14:10 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]

"Kai Großjohann" <kai.grossjohann@uni-duisburg.de> wrote in message
news:84n0nep8bh.fsf@lucy.cs.uni-dortmund.de...
> "CarlC" <carlc@snowbd.com> writes:
>
> > session stores search-ring as a global list of search strings. C-s
> > C-s works from the last string in this global list. I want to
> > remember the last search string for the individual file.
>
> Sounds like an interesting feature, but I don't think Emacs has it.
> Hm.  I can't find the variable that would hold the history for
> isearch.
>
> What happens if you do M-: (make-local-variable 'isearch-string) RET
> in a buffer?  Then C-s C-s in that buffer should remember the last
> search from that buffer, instead of the last search in any buffer.

I don't want to completely segregate search strings between buffers. When I
save a file, I want emacs to "remember" the latest search string so that
when I re-edit the file, C-s C-s will use that string. If I save one file
right after another, they would have the same search string saved. Seems
trivial, but is useful in our environment.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-10 14:10       ` CarlC
@ 2002-12-10 18:06         ` Kai Großjohann
  2002-12-10 20:59           ` CarlC
  2002-12-13 23:21         ` Alan Mackenzie
  1 sibling, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 2002-12-10 18:06 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> I don't want to completely segregate search strings between buffers. When I
> save a file, I want emacs to "remember" the latest search string so that
> when I re-edit the file, C-s C-s will use that string. If I save one file
> right after another, they would have the same search string saved. Seems
> trivial, but is useful in our environment.

I'm afraid you have to do it yourself, then.

It's not clear to me how to find out if two files are saved `right
after another'.  Hm.  You would have to arrange for Emacs to save the
search strings in an extra file on exit.  Hm.  desktop.el can already
save some things, and I think it can be configured to save more, so
you might be able to hook into that.

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-10 18:06         ` Kai Großjohann
@ 2002-12-10 20:59           ` CarlC
  2002-12-11 16:27             ` Kai Großjohann
  0 siblings, 1 reply; 12+ messages in thread
From: CarlC @ 2002-12-10 20:59 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]


"Kai Großjohann" <kai.grossjohann@uni-duisburg.de> wrote in message
news:84vg21yciw.fsf@lucy.cs.uni-dortmund.de...
> "CarlC" <carlc@snowbd.com> writes:
>
> It's not clear to me how to find out if two files are saved `right
> after another'.  Hm.  You would have to arrange for Emacs to save the
> search strings in an extra file on exit.  Hm.  desktop.el can already
> save some things, and I think it can be configured to save more, so
> you might be able to hook into that.

It doesn't matter to me when a file is saved. I just want to have the search
string saved with that file. From what I have read, desktop.el is not what I
want. I think that session.el _can_ do what I want, but am having trouble
saving isearch-string as a local variable. Let's say that I open file A,
search for "123", make some mods and then save file A. When I open file B,
C-s C-s will do a search for "123" if I use session.el. I want this to do a
search on the string that was used when I last saved file B, not file A.

My impression of desktop.el is that it will resume my last session exactly
as I left it. All buffers opened with cursor in last position, etc. I just
want to be able to open a file explicitly and retain position and search
string from the previous edit of that file.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-10 20:59           ` CarlC
@ 2002-12-11 16:27             ` Kai Großjohann
  0 siblings, 0 replies; 12+ messages in thread
From: Kai Großjohann @ 2002-12-11 16:27 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> "Kai Großjohann" <kai.grossjohann@uni-duisburg.de> wrote in message
> news:84vg21yciw.fsf@lucy.cs.uni-dortmund.de...
>> "CarlC" <carlc@snowbd.com> writes:
>>
>> It's not clear to me how to find out if two files are saved `right
>> after another'.  Hm.  You would have to arrange for Emacs to save the
>> search strings in an extra file on exit.  Hm.  desktop.el can already
>> save some things, and I think it can be configured to save more, so
>> you might be able to hook into that.
>
> It doesn't matter to me when a file is saved.

Previously, you said that you want to `group' files.  So if you save
fileA and fileB `together', then they should share the same search
string.  That's at least what I understood from your previous message.

> [...]
> My impression of desktop.el is that it will resume my last session exactly
> as I left it. All buffers opened with cursor in last position, etc. I just
> want to be able to open a file explicitly and retain position and search
> string from the previous edit of that file.

So we're back to square one.  You want to make isearch-string
buffer-local.  Then you want to make sure that the buffer-local value
is saved when you exit Emacs and loaded again when you enter Emacs
again.

First, please try whether it works to make the variable buffer-local.

Secondly, investigate how session.el or desktop.el allows you to save
per-buffer settings.

If that all pans out well, the following should do it:

(1) Tell Emacs that isearch-string is buffer-local, by putting
    (require 'isearch)
    (make-variable-buffer-local 'isearch-string)
    into ~/.emacs.

(2) Tell session.el or desktop.el to save the value of isearch-string
    for each buffer.

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-09 15:39 Search Next CarlC
  2002-12-09 15:52 ` Galen Boyer
  2002-12-10 11:15 ` ken
@ 2002-12-12 15:23 ` Benjamin Riefenstahl
  2 siblings, 0 replies; 12+ messages in thread
From: Benjamin Riefenstahl @ 2002-12-12 15:23 UTC (permalink / raw)


Hi Carl,

"CarlC" <carlc@snowbd.com> writes:
> On a related subject, what is the name of the variable that stores
> this last search string? I want to be able to save this for each
> file from session.el.

Looking at isearch.el and a bit of testing suggests that the variables
search-ring and regexp-search-ring contain the relevant history of
searches.  These variables are not buffer-local.  They are saved by
desktop.el.

Hope this helps, benny

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-10 14:10       ` CarlC
  2002-12-10 18:06         ` Kai Großjohann
@ 2002-12-13 23:21         ` Alan Mackenzie
  2002-12-14 19:56           ` Stefan Monnier <foo@acm.com>
  1 sibling, 1 reply; 12+ messages in thread
From: Alan Mackenzie @ 2002-12-13 23:21 UTC (permalink / raw)


CarlC <carlc@snowbd.com> wrote on Tue, 10 Dec 2002 14:10:32 GMT:

> I don't want to completely segregate search strings between buffers.
> When I save a file, I want emacs to "remember" the latest search string
> so that when I re-edit the file, C-s C-s will use that string. If I
> save one file right after another, they would have the same search
> string saved. Seems trivial, but is useful in our environment.

Desktop does that :-).  Look up the emacs manual page "Saving Emacs
Sessions".

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Search Next
  2002-12-13 23:21         ` Alan Mackenzie
@ 2002-12-14 19:56           ` Stefan Monnier <foo@acm.com>
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-12-14 19:56 UTC (permalink / raw)


>> I don't want to completely segregate search strings between buffers.
>> When I save a file, I want emacs to "remember" the latest search string
>> so that when I re-edit the file, C-s C-s will use that string. If I
>> save one file right after another, they would have the same search
>> string saved. Seems trivial, but is useful in our environment.
> Desktop does that :-).

Be careful about the case where the user does:

   > emacs some-file
   C-s foobar
   C-x k RET
   C-x C-c

In such a case, `desktop' won't see the `some-file' buffer since it's
been killed before exiting.


        Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-12-14 19:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-09 15:39 Search Next CarlC
2002-12-09 15:52 ` Galen Boyer
     [not found]   ` <KI4J9.122660$Gc.3983550@twister.austin.rr.com>
2002-12-09 21:16     ` Kevin Rodgers
2002-12-10  8:49     ` Kai Großjohann
2002-12-10 14:10       ` CarlC
2002-12-10 18:06         ` Kai Großjohann
2002-12-10 20:59           ` CarlC
2002-12-11 16:27             ` Kai Großjohann
2002-12-13 23:21         ` Alan Mackenzie
2002-12-14 19:56           ` Stefan Monnier <foo@acm.com>
2002-12-10 11:15 ` ken
2002-12-12 15:23 ` Benjamin Riefenstahl

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).