Skip to content

Commit

Permalink
don't rely on evil state when reconciling level
Browse files Browse the repository at this point in the history
This is a general step towards maintaining a distinct notion of a
current mode within Rigpa, which may use the current mode reported by
Evil or Lithium as part of its operation.

But it also is in response to a bug where [u]ndo'ing while in Symex
mode causes the level to be reconciled to the level of Normal in the
current tower (e.g. 2), even though we remain in Symex state. This
seems to happen because as of emacs-evil/evil#1888, undoing explicitly
goes into Normal state first, and then returns to whatever the
original state was. In Rigpa, Normal is backed by Evil but Symex is
backed by Lithium, even though it sets the Evil state for UI feedback
purposes. As a result, we only watch the Evil state transition to
reconcile the level when entering Normal state, but not Symex state,
since we do not expect the Evil state transition to be the way in
which Symex state is entered (it's rather just an effect of Symex mode
entry via Lithium). As a result, during the undo operation, we see the
transition to Normal and reconcile the level to 2, but do not see the
transition back to (evil) Symex state, and thus do not reconcile the
level back again to 1.

This fix alleviates the bug because even though
`rigpa--reconcile-level` is still only called upon Normal state entry,
it does not result in the level actually changing because Rigpa's
determination of current mode now first checks whether a Lithium mode
is active, before checking the evil state. So even though the latter
has changed during the undo operation, the mode remains the same as
before, as the former has not changed.
  • Loading branch information
countvajhula committed Sep 12, 2024
1 parent f447d8e commit 562f9ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rigpa-mode-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ Priority: (1) provided mode if admissible (i.e. present in tower) [TODO]
If the current mode is present in the current tower, ensure that the
current level reflects the mode's position in the tower."
(interactive)
(let* ((mode-name (symbol-name evil-state))
(let* ((mode (rigpa-current-mode))
(mode-name (when mode (chimera-mode-name mode)))
(level-number
(rigpa-ensemble-member-position-by-name (rigpa--local-tower)
mode-name)))
Expand Down

0 comments on commit 562f9ed

Please sign in to comment.