[Top][All Lists]

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

Re: save-excursion and the mark

From: Andreas Röhler
Subject: Re: save-excursion and the mark
Date: Mon, 20 Apr 2015 08:31:04 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Stefan,

Am 14.04.2015 um 22:16 schrieb Stefan Monnier:
If you are indeed going forward with this change (why is that?),
There are various problems with the previous save-excursion semantics,
all linked to the mark-saving part of it, and this part is useless in
98% of the cases, useful in 1%, and harmful in 1%, so it's better to get
rid of it in my view.

Among the various problems, I actually fixed some recently (before
throwing out the code), but the remaining ones are ugly:
saving/restoring the mark includes saving/restoring the mark-active
state as well, and in the general case you'd also want to run the
(de)activate-mark-hook, which could break even more uses of
save-excursion which never expected it to run such hook code.

Understand the wish to simplify things in this context.

AFAIU there is some redundancy - what about deprecating explicit setting of mark-active?

Its documentation says:
Non-nil means the mark and region are currently active in this buffer.

Maybe conceive region-active-p just as non-nil extend between point and mark - returning nil in case a mark is not set?


then maybe we could get a save-mark function?
Since you're the only user so far, better write explicitly the exact
saving/restoring you need (especially since it's not obvious to me what
it is you really need, I guess you could start with something along the
lines of (cl-letf (((mark)) (mark-active mark-active)) ...)).


reply via email to

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