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

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

erase-buffer and marker-position


From: Thorsten Jolitz
Subject: erase-buffer and marker-position
Date: Tue, 26 Feb 2013 05:11:46 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux)

Hi List, 

what is the canonical way to remember/restore the (relative) old
marker-position when a buffer is erased? Without any further action,
marker-position is '1' after a buffer is erased and new content was
inserted. Thats somehow logical behaviour, since in the empty buffer,
marker is at position 1, and the new content is inserted after the
marker.

However, in my use case the new content inserted after erasing the
buffer often is a superset (or subset) of the old content and may
contain the content around the old marker-position.

What I would need is a way to keep the marker at its position as if the
content before and after the marker would have been erased, and the new
content would have been inserted before and after the marker. That is
(with * -> marker-position):

,------------------
| old text before 
| amazing * theorem
| old text after
`------------------

gives

,------------------
| new text before 
| new text before 
| new text before 
| amazing * theorem
| new text after
| new text after
`------------------

after erasing and inserting, instead of

,------------------
| * new text before
| new text before 
| new text before 
| amazing theorem
| new text after
| new text after
`------------------

-- 
cheers,
Thorsten





reply via email to

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