emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/eat a1c4422f21 1/2: Support middle-click yank in terminal


From: ELPA Syncer
Subject: [nongnu] elpa/eat a1c4422f21 1/2: Support middle-click yank in terminal
Date: Sat, 6 May 2023 08:59:43 -0400 (EDT)

branch: elpa/eat
commit a1c4422f21017d78068bfe714156155886b5afdc
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Support middle-click yank in terminal
    
    * eat.el (eat-mouse-yank-primary, eat-mouse-yank-secondary):
    New command.
    * eat.el (eat--prepare-semi-char-mode-map)
    (eat--eshell-prepare-semi-char-mode-map): Remap commands
    'mouse-yank-primary' and 'mouse-yank-secondary' to
    'eat-mouse-yank-primary' and 'eat-mouse-yank-secondary'
    respectively.
---
 eat.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/eat.el b/eat.el
index 2587029623..652a27274d 100644
--- a/eat.el
+++ b/eat.el
@@ -5103,6 +5103,17 @@ STRING and ARG are passed to `yank-pop', which see."
          (yank-from-kill-ring string arg)
          (buffer-string))))))
 
+(defun eat-mouse-yank-primary ()
+  "Send the primary selection to the terminal."
+  (interactive)
+  (eat-send-string-as-yank eat--terminal (gui-get-primary-selection)))
+
+(defun eat-mouse-yank-secondary ()
+  "Send the secondary selection to the terminal."
+  (interactive)
+  (eat-send-string-as-yank
+   eat--terminal (gui-get-selection 'SECONDARY)))
+
 (defun eat-xterm-paste (event)
   "Handle paste operation EVENT from XTerm."
   (interactive "e")
@@ -5143,6 +5154,10 @@ STRING and ARG are passed to `yank-pop', which see."
     (define-key map [?\C-c ?\C-c] #'eat-self-input)
     (define-key map [?\C-c ?\C-e] #'eat-emacs-mode)
     (define-key map [remap insert-char] #'eat-input-char)
+    (define-key map [remap mouse-yank-primary]
+                #'eat-mouse-yank-primary)
+    (define-key map [remap mouse-yank-secondary]
+                #'eat-mouse-yank-secondary)
     (define-key map [xterm-paste] #'eat-xterm-paste)
     map))
 
@@ -5822,6 +5837,10 @@ PROGRAM can be a shell command."
     (define-key map [?\M-y] #'eat-yank-from-kill-ring)
     (define-key map [?\C-c ?\C-e] #'eat-eshell-emacs-mode)
     (define-key map [remap insert-char] #'eat-input-char)
+    (define-key map [remap mouse-yank-primary]
+                #'eat-mouse-yank-primary)
+    (define-key map [remap mouse-yank-secondary]
+                #'eat-mouse-yank-secondary)
     (define-key map [xterm-paste] #'eat-xterm-paste)
     map))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]