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: Fri, 28 Nov 2008 19:18:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Andreas Politz <politza@fh-trier.de> writes:

> tyler wrote:
>>
>> The real question is why save-excursion *doesn't* do this. The
>> documentation states that point is restored. Either 'restoring' point
>> means something other than setting point to equal the previously saved
>> value, or there is something missing in the documentation.
>>
>
> save-excursion stores a marker, not the 'byte' number. When you kill
> the line where point is, this marker gets replaced to the beginning of
> the line.
>
> ,----[ (info "(elisp)Excursions") ]
> |    *Warning:* Ordinary insertion of text adjacent to the saved point
> | value relocates the saved value, just as it relocates all markers.
> | More precisely, the saved value is a marker with insertion type `nil'.
> | *Note Marker Insertion Types::.  Therefore, when the saved point value
> | is restored, it normally comes before the inserted text.
> `----
>

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.

Tyler

-- 






reply via email to

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