emacs-devel
[Top][All Lists]
Advanced

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

Re: html, css, and js modes working together


From: Stefan Monnier
Subject: Re: html, css, and js modes working together
Date: Sun, 12 Feb 2017 12:14:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> If that's the case, then it seems to me that cursor-sensor-functions
> should be run in the scenario I described -- because in that scenario,
> point does change.

I think what you want is to run commands in a context that depends on
point.  In that case I think that pre-command-hook sounds like the
better option (and no, it's definitely not particularly expensive: it's
run less often than the cursor-sensor--detect used internally by
cursor-sensor-mode).

As to whether cursor-sensor-functions would be more or less useful if it
were defined to react on movement of the "buffer cursor" rather than the
"window cursor".  You might be right.  I truly don't know.  Many uses of
such "position sensitivity" should ideally be "per window", IMO, which
is why I implemented it this way, but at the same time, many users of
that feature then go on and change buffer state (often with not
much other choice) rather than window state.

E.g. table.el uses cursor-sensor-functions to detect when we're inside
a table and update the mode-line lighter accordingly.  But that
currently breaks when we have several windows showing the same buffer
because its lighter's state is define per-buffer rather than per-window.


        Stefan



reply via email to

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