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

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

Re: Why save-excursion doesn't restore cursor position after 3 kill-line


From: tyler
Subject: Re: Why save-excursion doesn't restore cursor position after 3 kill-line calls?
Date: Sat, 29 Nov 2008 13:28:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.1463.1227914342.26697.help-gnu-emacs@gnu.org>,
>  tyler <tyler.smith@mail.mcgill.ca> wrote:
>
>> Thanks. I think I understand, at least generally, what's going on now.
>> Markers are a new concept for me, so I'll have to do some more reading
>> to sort out the details.
>
> Here's a simple example that may help.  Suppose you have a buffer 
> containing:
>
> 1 abcdef
> 2 123456
> 3 wxyz
>
> and point is on line 2 between 3 and 4.  You write a function that uses 
> save-excursion while it deletes line 1.  When the save-excursion ends, 
> point will still be between 3 and 4, although this will now be line 1.
>
> The intent is to continue pointing to the same text that it originally 
> pointed to.  But if that text itself is deleted, this is obviously not 
> possible.  Any markers that were within the deleted text will end up 
> pointing to the place where the text used to be.

Thanks, that does help!

Tyler

-- 
I never loan my books, for people never return them. The only books
remaining in my library are those I’ve borrowed from others. 





reply via email to

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