help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: search&replace macro puzzle please help...


From: Ehud Karni
Subject: Re: search&replace macro puzzle please help...
Date: Thu, 20 Sep 2001 12:13:08 +0300

On Mon, 17 Sep 2001 13:33:46 -0700, Chris Seberino <seberino@spawar.navy.mil> 
wrote:
> 
> I want a search and replace command that 
> 
> 1. works thru entire doc
> 2. ends up in same place as before
> 
> I got this so far...
>   [sniped elisp code]
> THE TRICKY PART IS GETTING CURSOR BACK TO ORIGINAL
> POSITION.  .....

You have 2 (may be more) choices, 1. save the current position in a 
marker (by set-marker) and than return to it. 2. use save-excursion.
The 2nd option is better because it guarantees that the buffer pointer
will be restored to the original position even if the commands executed
does not terminate normally (throw or error).

Ehud.


-- 
 Ehud Karni     Mivtach - Simon  Insurance   /"\
 Tel: +972-3-7966-561 Fax: +972-3-7966-667   \ /  ASCII Ribbon Campaign
 (USA) Fax and  voice  mail: 1-815-5509341    X   Against  HTML  Mail
     Better     Safe     Than     Sorry      / \
     mailto:ehud@unix.simonwiesel.co.il    http://www.simonwiesel.co.il



reply via email to

[Prev in Thread] Current Thread [Next in Thread]