unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* erase-buffer and marker-position
@ 2013-02-26  4:11 Thorsten Jolitz
  2013-02-26  4:46 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-02-26  4:11 UTC (permalink / raw)
  To: help-gnu-emacs


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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-26  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26  4:11 erase-buffer and marker-position Thorsten Jolitz
2013-02-26  4:46 ` Stefan Monnier
2013-02-26  4:50   ` Thorsten Jolitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).