From b3addc78248d0863477daed28672441880e2333d Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 4 Oct 2025 10:51:48 +0200 Subject: Fine-tune my/kill-as-html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bind to C-c k W * port to Wayland (could have branched on XDG_SESSION_TYPE; ain't nobody got time) * echo for feedback (wouldn't it be nice to ask HTML mode to fontify the echoed string…) --- .config/emacs/init.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index de8a622..895472a 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -325,10 +325,11 @@ list and require no escaping." ("u" ,(my/make-input-toggle my/symbols)))) (my/define-prefix-command my/kill-map - "Keymap for adding things to the kill ring." + "Keymap for adding things to the kill ring (or system clipboard)." '(("C" my/kill-char) ("d" my/kill-date) ("f" my/kill-filename) + ("W" my/kill-as-html) ("|" my/kill-pipe-region) ("!" my/kill-shell))) @@ -682,8 +683,9 @@ UPSTREAMS is a list of fetch URLs." ;; it sound like passing a value with a 'text/html property set to ;; the HTML string should work, but empirically it doesn't. ;; Maybe look into `selection-converter-alist'. - (call-process-region nil nil "xclip" nil nil nil - "-selection" "clipboard" "-target" "text/html"))) + (call-process-region + nil nil "wl-copy" nil 0 nil "--type" "text/html") + (message "Copied:\n\n%s" (buffer-string)))) (defun my/yank-from-html (html markup) (interactive -- cgit v1.2.3