dwcoates / pygn-mode

An Emacs major-mode for chess PGN files, powered by Python
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Bugfix: partially unbreak pygn-mode-follow-minor-mode #173

Closed rolandwalker closed 3 years ago

rolandwalker commented 3 years ago

pygn-mode-follow-minor-mode stopped working with the transition to tree-sitter.

There are multiple issues.

Pygn-mode must be made active in temp buffers, or the tree-sitter parse tree isn't present in those buffers, and pygn-mode motion commands have no points of reference.

In addition, before tree-sitter, the mode was lenient about the spaces in between games. Tree-siiter however, "knows" that a position in the whitespace between two games is not part of any game node -- and it only knows how to be strict about that. So we introduce a special pygn-mode-game-start-position-forgive-trailing-pos which is a quick fix and surely not the best, ultimate, general fix.

After this PR, pygn-mode-follow-minor-mode works correctly, IFF pygn-mode-next-move and pygn-mode-previous-move are used to navigate. But if I move the cursor freely through variations and comments, the "follow" board window eventually stops being updated at all, and the follow mode stops working.

So there are still more fixes to be found.

rolandwalker commented 3 years ago

@dwcoates I'm going to self-merge this on green, since there is a big regression here.