[Top][All Lists]

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

Re: save-excursion and the mark

From: Wolfgang Jenkner
Subject: Re: save-excursion and the mark
Date: Sat, 18 Apr 2015 14:30:58 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (berkeley-unix)

On Sat, Apr 18 2015, Stefan Monnier wrote:

>> Code that previously relied on `save-excursion' restoring the mark no
>> longer works, and that's fine.  But could we have a new form like
>> `save-mark' (or something) that we could just slap around forms that
>> previously relied on this form behaving the old way?
> (cl-letf (((mark))) ...) might do the trick.
> Or maybe you'll need (cl-letf (((mark)) (mark-active)) ...).
> note that if the "..." activates or deactivates the mark, you're
> probably somewhat in trouble in the sense that (de)activate-mark-hook
> will be run, despite the cl-letf, and you can't really undo the effect
> of running a hook.

It would be useful to know which existing uses of (de)activate-mark-hook
are worrisome.

In lisp/ there are very few instances where functions are added to those
hooks (only for rectangle marking and "enhanced edt keypad mode
emulation", whatever that is).  In elpa, there seems to be none at all.
So, those uses seem too marginal to draw conclusions.

In theory, of course, there are ways to set or bind symbols which are
not amenable to grepping, so I might have missed something.

The instance of emacs I'm running says

    activate-mark-hook is a variable defined in `simple.el'.
    Its value is (evil-visual-activate-hook t)
    Local in buffer *unsent wide reply to Stefan Monnier*; global value is nil

I'd guess that most users of evil turn on evil-mode, which is
a globalized minor mode, so any problem with some inadvertent use of
save-excursion would have surfaced quickly.


reply via email to

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