From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Saving (and finding) markers
Date: Thu, 18 Oct 2018 21:36:14 +0200 [thread overview]
Message-ID: <87sh13oxn5.fsf@portable.galex-713.eu> (raw)
In-Reply-To: <83a7nbqf6n.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 18 Oct 2018 21:32:00 +0300")
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).
next prev parent reply other threads:[~2018-10-18 19:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 1:43 point moved despite save-excursion, after deleting/reinserting region Garreau, Alexandre
2018-10-17 16:12 ` Eli Zaretskii
2018-10-17 20:13 ` Garreau, Alexandre
2018-10-18 2:38 ` Eli Zaretskii
2018-10-18 9:50 ` Garreau, Alexandre
2018-10-18 11:32 ` Yuri Khan
2018-10-18 11:45 ` Garreau, Alexandre
2018-10-18 13:16 ` Eli Zaretskii
2018-10-18 18:08 ` Saving (and finding) markers (Was: Re: point moved despite save-excursion, after deleting/reinserting region) Garreau, Alexandre
2018-10-18 18:32 ` Eli Zaretskii
2018-10-18 19:36 ` Garreau, Alexandre [this message]
2018-10-18 20:11 ` Saving (and finding) markers Eli Zaretskii
2018-10-19 1:15 ` Stefan Monnier
2018-10-19 6:38 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sh13oxn5.fsf@portable.galex-713.eu \
--to=galex-713@galex-713.eu \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).