Repository navigation
Add ghostel-readonly-change-hook - #737
Merged
Merged
Conversation
Run a hook from ghostel--sync-read-only whenever buffer-read-only actually flips, so integrations that derive state from it (cursor shape, mode-line indicators) have a supported trigger for the spawn, process exit and input-mode transitions instead of advising internals. Line-mode entry and teardown and buffer reinit wrote buffer-read-only directly between two syncs; those writes were redundant (the code in between binds inhibit-read-only) and would have hidden the copy<->line flips from the hook, so they now go through the sync as well. Closes #719.
An interactive ghostel-compile run is writable until the process exits, and finalize switched to the compilation-derived major mode without syncing, so ghostel-readonly-change-hook never saw the exit. Sync right after the terminal teardown. During a compilation-style run the buffer keeps ghostel-mode but uses ghostel-compile-view-mode-map, which lacked the C-x C-q remap, so read-only-mode toggled buffer-read-only underneath the renderer. Remap it to ghostel-readonly-enter while the buffer is still ghostel-mode; the finished compilation buffer keeps plain read-only-mode.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ghostel-readonly-change-hook, run fromghostel--sync-read-onlywheneverbuffer-read-onlyactually flips: process spawn and exit, and every input-mode switch. Gives state-driven integrations (cursor shape keyed on read-only state, mode-line indicators) a supported trigger instead of advising internals.buffer-read-onlydirectly between two syncs. The writes were redundant (the code in between bindsinhibit-read-only) and would have hidden the copy↔line flips from the hook, so they now go through the sync.Closes #719.
Test plan
make -j8 allclean (build, lint, elisp + native tests).ghostel-test-readonly-change-hook-fires-on-change-only: fires on t→nil and nil→t, not on a no-op resync.(input-mode read-only)per firing:(semi-char nil)(copy t) (line nil) (copy t) (line nil)(emacs t) (semi-char nil)exitin semi-char →(semi-char t);exitin line mode → none (line mode stays writable)ghostel-execreinit of a dead line-mode buffer →(semi-char t) (semi-char nil)