From 80e2ebc852d16fb863224cbd68508ceb73b0bce3 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 14 Jun 2025 18:17:04 +0200 Subject: Add command to send character to clipboard Useful to re-purpose an Emacs session as a severely oversized Unicode character picking widget. Bind to uppercase 'C' rather than 'c' since $DAYJOB config uses the latter for 'c'ite (kill a region with added '> ' markers). --- .config/emacs/init.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 7ce7b11..3fe49c6 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -200,6 +200,10 @@ Raise a user error if the command fails. Heed `my/run-strip-newline'." See `my/run' for details, e.g. status handling and output massaging." (my/kill (apply 'my/run program args))) +(defun my/kill-char (c) + (interactive (list (read-char-by-name "Codepoint? " t))) + (my/kill (string c))) + (defun my/kill-date (date format) (interactive (if current-prefix-arg @@ -306,7 +310,8 @@ list and require no escaping." (my/define-prefix-command my/kill-map "Keymap for adding things to the kill ring." - '(("d" my/kill-date) + '(("C" my/kill-char) + ("d" my/kill-date) ("f" my/kill-filename) ("|" my/kill-pipe-region) ("!" my/kill-shell))) -- cgit v1.2.3