File: cursor-sensor.el.html
This package implements the cursor-intangible and
cursor-sensor-functions properties, which are meant to replace
the old intangible, point-entered, and point-left properties.
To use cursor-intangible, just enable the
cursor-intangible-mode(var)/cursor-intangible-mode(fun) minor mode, after which this package will
move point away from any position that has a non-nil
cursor-intangible property. This is only done just before
redisplay happens, contrary to the old intangible property which
was done at a much lower level.
To use cursor-sensor-functions, enable the cursor-sensor-mode(var)/cursor-sensor-mode(fun)
minor mode, after which the cursor-sensor-functions will be
called just before redisplay happens, according to the movement of
the cursor since the last redisplay.
;; Motivation
The old properties were very problematic in practice because they
operate at a much lower level and hence affect all motion
*functions* like goto-char, forward-char, ... hence breaking
invariants like:
(forward-char N) == (progn (forward-char N1) (forward-char (- N N1)))
(point) == (progn (forward-char N) (forward-char -N) (point))
(+ N (point)) == (progn (forward-char N) (point))
The problems would usually show up due to interaction between unrelated code working in the same buffer, where one code used those properties and the other (unknowingly) assumed those aren't used. In practice a *lot* of code assumes there's no such funny business.
Worse: all(?) packages using those properties don't actually want those properties to affect motion at such a low-level, they only want to affect the overall effect of commands, but not the effect of every single point-motion that a given command happened to use internally.
Defined variables (5)
cursor-intangible-mode | Non-nil if Cursor-Intangible mode is enabled. |
cursor-intangible-mode-hook | Hook run after entering or leaving ‘cursor-intangible-mode’. |
cursor-sensor-inhibit | When non-nil, suspend ‘cursor-sensor-mode’ and ‘cursor-intangible-mode’. |
cursor-sensor-mode | Non-nil if Cursor-Sensor mode is enabled. |
cursor-sensor-mode-hook | Hook run after entering or leaving ‘cursor-sensor-mode’. |
Defined functions (7)
cursor-intangible-mode | (&optional ARG) |
cursor-sensor--detect | (&optional WINDOW) |
cursor-sensor--intangible-p | (POS) |
cursor-sensor--move-to-tangible | (WINDOW) |
cursor-sensor-mode | (&optional ARG) |
cursor-sensor-move-to-tangible | (WINDOW) |
cursor-sensor-tangible-pos | (CURPOS WINDOW) |