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

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

Re: point moved despite save-excursion, after deleting/reinserting regio


From: Eli Zaretskii
Subject: Re: point moved despite save-excursion, after deleting/reinserting region
Date: Thu, 18 Oct 2018 05:38:08 +0300

> From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 17 Oct 2018 22:13:28 +0200
> 
> The point was, say, in the middle of the SRC block, and (as I said in
> the subject) after the operation, was moved: at the end of the block.
> 
> This must be because I deleted a region of text (the whole SRC block)
> then reinserted it (or rather, its original content, so that to restore
> buffer as before), so the point is after the insertion.
> 
> However, I’d have expected save-excursion to put the point again where
> it was inside the block.

If that's what you want, why not record the position of point before
the delete/insert operation and restore it afterwards?

> Is there something such as `restore-markers'/`save-markers' that would
> allow me to restore point after doing this operation?  Or better some
> `save-buffer-content' like `save-excursion' but restoring the buffer
> afterwards?

When you delete text, markers pointing into that text cannot follow,
they get relocated to the beginning/end of the deletion/insertion.
What else can Emacs do, given that it doesn't know your future
intentions?



reply via email to

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