Thanks for taking a look. Unfortunately it breaks several expansions, that use the current mark as input to its expansion. If you are indeed going forward with this change (why is that?), then maybe we could get a save-mark function?
On Wed, Apr 8, 2015 at 3:57 AM Stefan Monnier <
address@hidden> wrote:
> The change breaks expand-region, for one.
Looks like the problem is basically in er--expand-region-1 where you do:
(while try-list
(save-excursion
(ignore-errors
(setq mark-active nil)
(funcall (car try-list))
(when (and (region-active-p)
[...]
The test (region-active-p) is meant to check whether the (car try-list)
function activated the region, but you don't actually ensure that the
region is deactivated before the call. So if that function "fails" and
the region happened to be enabled when we entered er--expand-region-1 you
end up taking that "input region" as one of the choices.
In practice this was harmless, but I don't think it was ever correct.
The patch below seems to fix the behavior.
Stefan
diff --git a/expand-region-core.el b/expand-region-core.el
index ccab290..942318c 100644
--- a/expand-region-core.el
+++ b/expand-region-core.el
@@ -92,6 +92,7 @@ moving point or mark as little as possible."
(while try-list
(save-excursion
(ignore-errors
+ (setq mark-active nil)
(funcall (car try-list))
(when (and (region-active-p)
(er--this-expansion-is-better start end best-start best-end))