emacs-devel
[Top][All Lists]
Advanced

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

Re: save-excursion and the mark


From: Stefan Monnier
Subject: Re: save-excursion and the mark
Date: Tue, 14 Apr 2015 16:16:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> 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.

> 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)) ...)).


        Stefan



reply via email to

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