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: Barry Margolin
Subject: Re: Why save-excursion doesn't restore cursor position after 3 kill-line calls?
Date: Sat, 29 Nov 2008 03:21:11 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

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.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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