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

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

Re: Saving (and finding) markers


From: Garreau, Alexandre
Subject: Re: Saving (and finding) markers
Date: Thu, 18 Oct 2018 21:36:14 +0200
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu)

On 2018-10-18 at 21:32, Eli Zaretskii wrote:
>> From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Thu, 18 Oct 2018 20:08:05 +0200
>> 
>> I’m unaware of what other side-effects might happens because of deleting
>> and reinserting a region of text, but how, within a region, get all the
>> markers?
>
> You can't, because it makes no sense to do that.  Markers exist so
> that you could _avoid_ doing this stuff by hand as much as possible.
> If you are going to move markers by hand, you might as well not use
> markers at all, or stop caring for those which happened to be there.
>
> In general, Emacs already does the best it could with markers, when
> text around them is edited; you are unlikely to do better.

So it’s not possible to elisp to twiddle with markers that way?  I find
a such inextensibility sad (even if it’s already great, everything
should be modifiable I believe), but okay.

>> I’d like to try this method as it looks straightforward
>
> I _really_ suggest to try replace-buffer-contents first.  It should do
> the job cleanly and efficiently in many cases, and I very much doubt
> that you could do better.

> I pointed you to replace-buffer-contents function, because AFAIU in
> your situation it will modify the text while keeping as many markers
> (including point) intact as possible.  Did you try using it?

I might then use a separate buffer so to store the original content,
without doing the computation (C-c C-c) on it, and restore it later in
original buffer?

Looking to online manual it seems to be what I want, except it’s
undefined on my GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version
3.22.11) of 2017-09-15, modified by Debian.  Must be in next version of
emacs.  Still didn’t compiled it (on this X60 laptop whose thermal paste
change I procrastinated since some weeks, it won’t happen soon).



reply via email to

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