kkp icon indicating copy to clipboard operation
kkp copied to clipboard

`M-<backspace>` not working with Emacs and Kitty

Open swarnendubiswas opened this issue 1 year ago • 2 comments

I am using Emacs 29.3 and Kitty 0.35.1. I have installed kkp because a few key combinations do not work without it (Ctrl+').

M-<backspace> is defined to be (backward-kill-word) in Emacs. However, with kkp and Kitty, I get M-<backspace> is undefined. Could you please suggest how this can be fixed?

I see the behavior even without kitty.conf.

swarnendubiswas avatar Jun 09 '24 16:06 swarnendubiswas

Same for M-, eg in org-mode-map

sashkachan avatar Jun 16 '24 08:06 sashkachan

Try this: (global-set-key (kbd "M-<backspace>") (lookup-key (current-global-map) (kbd "ESC DEL")))

douo avatar Aug 21 '24 09:08 douo

I ran into the same issue. Without kkp, M-backspace gets remapped to M-DEL, which is then bound to backward-kill-word. For some reason, kkp blocks the remap. @douo's suggestion to bind M-backspace directly to backward-kill-word is a good workaround. Here's my setup using use-package:

(use-package kkp
  :bind
  ;; https://github.com/benjaminor/kkp/issues/13
  ("M-<backspace>" . backward-kill-word) ; should be remapped to "M-DEL"
  :config
  (global-kkp-mode 1))

That being said, kkp is a nifty little package, thanks for creating it!

dhanak avatar Jan 28 '25 08:01 dhanak

Hi, I pushed a fix for this in commit 4f7993a65729eb38b9fa4c2c341353b979bfbe76.

The reason M-<backspace> is not mapped to backward-kill-word is that actually M-DEL is the key mapped to backward-kill-word. On normal terminals without kkp, M-<backspace> is transmitted to the terminal directly as M-DEL. On x frames, there is a x-alternatives-map which is added as a parent to local-function-key-map and which translates M-<backspace> to M-DEL. I added a similar kkp-alternatives-map which should now do the same job.

benotn avatar Feb 05 '25 11:02 benotn

I will try the fix out over this weekend. Thanks!

frobware avatar Feb 08 '25 16:02 frobware

I see "M-DEL runs the command backward-kill-word" reported when using describe-key.

Thanks!

frobware avatar Feb 14 '25 20:02 frobware

Thanks for testing! I'll close this now, if anyone experiences this issue again feel free to reopen or open a new issue.

benotn avatar Feb 14 '25 21:02 benotn