kkp icon indicating copy to clipboard operation
kkp copied to clipboard

User error: can't get this package to do anything

Open patmaddox opened this issue 1 year ago • 1 comments

Hi there, I've installed and activated this package per the instructions, and when I run kkp-status it reports:

KKP supported in this terminal. KKP active in this terminal. Enabled enhancements: report-alternate-keys and disambiguate-escape-codes

I have tried this in both Kitty and WezTerm (with enable_kitty_keyboard on).

In both cases, it doesn't seem to do anything. C-i still sends tab. C-S <anything> typically doesn't send anything.

Any idea what I'm missing?

--

  • kkp.el ed92143
  • emacs 29.4
  • wezterm 20240203-110809-5046fc22
  • kitty 0.36.2
  • FreeBSD 14-STABLE

patmaddox avatar Sep 13 '24 09:09 patmaddox

@patmaddox I too was thrown off by this line in the README

it transmits “<tab>” and “C-i” differently

and assumed this package wasn't working because C-h k C-i shows TAB. But try a different key (eg C-1) with and without this package and you'll see that it does its job. The Ctrl+Shift prefix might not always be working for you because your OS/terminal might be using that as a keybinding for some other purpose.

chetan-reddy avatar Sep 20 '24 21:09 chetan-reddy

Hi, I am quite hopeful kkp works in your terminal.

You can now check yourself how your key input is translated with kkp-debug-describe-key-translation-chain (see README).

For me usually C-S <something> reverts to C-<something> if there is no mapping for C-S <something>. But, as you can check yourself, if you evaluate (global-set-key (kbd "C-S-g") 'revert-buffer), then you'll get a different result when you hit the keybinding in a terminal with kkp and in one without it.

Regarding the tab, unfortunately, the example I chose in the README is maybe not the best. The spec says: "The only exceptions are the Enter, Tab and Backspace keys which still generate the same bytes as in legacy mode this is to allow the user to type and execute commands in the shell such as reset after a program that sets this mode crashes without clearing it."

This means:

  • If you type in TAB, it gets communicated via byte 9 to the terminal.
  • If you type in C-i, it gets communicated via M-[ 1 0 5 ; 5 u to the terminal. Then kkp translates it to the keystring "C-i" but as you can check (kbd "C-i") results in TAB again.
  • Only Emacs in a window gets <tab> directly as an input and can thus translate it differently. So I'm afraid there's not much I can do regarding the terminal situation.

I'll close this issue for now, feel free to reopen or to open a new one if you have other issues with kkp.

benotn avatar Feb 05 '25 11:02 benotn