From ac1587b63db6663cfeae4e919d29a2ad9728f6e9 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 14 Jul 2020 13:32:21 +0200 Subject: [PATCH] Fix EXWM edit. --- .emacs.d/lisp/init-exwm.el | 3 ++- .emacs.d/lisp/patch-exwm-edit.el | 40 -------------------------------- 2 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 .emacs.d/lisp/patch-exwm-edit.el diff --git a/.emacs.d/lisp/init-exwm.el b/.emacs.d/lisp/init-exwm.el index 733f507e..69bbf29e 100644 --- a/.emacs.d/lisp/init-exwm.el +++ b/.emacs.d/lisp/init-exwm.el @@ -272,6 +272,7 @@ WIth SETTING to :ENABLE or :DISABLE, set" (setq exwm-edit-bind-default-keys nil) (when (require 'exwm-edit nil 'noerror) - (require 'patch-exwm-edit)) + (exwm-input-set-key (kbd "C-c '") #'exwm-edit--compose) + (exwm-input-set-key (kbd "C-c C-'") #'exwm-edit--compose)) (provide 'init-exwm) diff --git a/.emacs.d/lisp/patch-exwm-edit.el b/.emacs.d/lisp/patch-exwm-edit.el deleted file mode 100644 index ecb7f0e1..00000000 --- a/.emacs.d/lisp/patch-exwm-edit.el +++ /dev/null @@ -1,40 +0,0 @@ -;; See https://github.com/agzam/exwm-edit/issues/7. - -(defun exwm-edit--compose () - "Edit text in an EXWM app." - (interactive) - ;; flushing clipboard is required, otherwise `gui-get-selection` simply picks up what's in the clipboard (when nothing is actually selected in GUI) - (gui-set-selection nil nil) - (let* ((title (exwm-edit--buffer-title (buffer-name))) - (existing (get-buffer title)) - (inhibit-read-only t) - (save-interprogram-paste-before-kill t) - (selection-coding-system 'utf-8) ; required for multilang-support - (sel (gui-get-selection)) - (unmarked? (or (not sel) - (string= (substring-no-properties (or sel "")) - (substring-no-properties (or (car kill-ring) "")))))) - (when (derived-mode-p 'exwm-mode) - (setq exwm-edit--last-exwm-buffer (buffer-name)) - (unless (bound-and-true-p global-exwm-edit-mode) - (global-exwm-edit-mode 1)) - (if existing - (switch-to-buffer-other-window existing) - (progn - (when unmarked? (exwm-input--fake-key ?\C-a)) - (let ((buffer (get-buffer-create title))) - (with-current-buffer buffer - (run-hooks 'exwm-edit-compose-hook) - (exwm-edit-mode 1) - (switch-to-buffer-other-window buffer) - (let ((sel (and (gui-get-selection) ; TODO: This is the fix, not sure why it works. - (gui-get-selection)))) - (kill-new sel) - (insert sel)) - (setq-local - header-line-format - (substitute-command-keys - "Edit, then exit with `\\[exwm-edit--finish]' or cancel with \ `\\[exwm-edit--cancel]'"))))))))) - - -(provide 'patch-exwm-edit)