Bind S-<insert> and remap yank to ghostel-yank#265
Merged
Conversation
Shift-Insert is the conventional alternative paste binding in browsers, terminal emulators, and file managers; binding it to ghostel-yank brings ghostel in line. In the same pass, layer <remap> <yank> onto the semi-char and readonly maps so any key Emacs binds to yank globally — s-v on macOS, plus user rebinds — routes through ghostel-yank without needing a per-key entry, and drop the now-redundant darwin s-v special cases from both maps. C-y stays explicitly bound so user rebinds of the global yank key cannot break ghostel paste. S-<insert> also needs an explicit binding in semi-char-mode-map because ghostel--define-terminal-keys otherwise routes it through ghostel--send-event as part of the <insert> modifier expansion; the readonly map doesn't call that helper and is caught by the remap alone. <XF86Paste> stays explicit in ghostel-mode-map (Emacs has no global binding for it to ride on). Line mode keeps Emacs's regular yank so paste lands in the input region. Closes #263.
e8cc375 to
b174678
Compare
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
S-<insert>toghostel-yankin semi-char and readonly modes — the conventional alternative paste shortcut in browsers, terminal emulators, and file managers.<remap> <yank>to both maps so anything Emacs globally binds toyank(notablys-von macOS, plus user rebinds) routes throughghostel-yankwithout a per-key entry. The darwins-vspecial-case blocks in both maps are now redundant and removed.C-ystays explicitly bound so user rebinds ofyank's global key cannot break ghostel paste. Line mode keeps Emacs's regularyank(paste lands in the editable input region). Char mode is unchanged.Closes #263.
Why
S-<insert>needs an explicit binding (not just the remap)ghostel--define-terminal-keysiterates<insert>×(S- C- M- C-S- M-S- C-M-)and binds every combo toghostel--send-event. That's a direct binding inghostel-semi-char-mode-map, and direct bindings win over the<remap>chain — remap only fires on the command that the literal-key lookup resolves to.s-vflows through the remap fine because the helper's modifier list excludes super. Readonly mode never calls the helper, so the remap is enough there.Test plan
make -j4 all— 354 tests, 352 pass, 0 unexpected, 2 pre-existing skips (bash-completion availability).ghostel-test-yank-remap-bindingscovers the[remap yank]entries in semi-char/readonly, the absence of the remap in line/char modes, char mode'sS-<insert>still going toghostel--send-event, and end-to-endkey-bindingresolution ofC-y/S-<insert>/s-v(darwin) in an active ghostel buffer.emacs --batchconfirmsC-y,S-<insert>, ands-vall resolve toghostel-yankin semi-char mode.S-<insert>and confirm bracketed paste arrives at the shell prompt; repeat in Emacs/copy mode.