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

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

[elpa] externals/gpastel 8444716 5/9: Send Emacs text to GPaste when in


From: Damien Cassou
Subject: [elpa] externals/gpastel 8444716 5/9: Send Emacs text to GPaste when in a terminal
Date: Sat, 29 Dec 2018 09:09:14 -0500 (EST)

branch: externals/gpastel
commit 844471659bb8d96472899c292ea054505fef04db
Author: Stefan Monnier <address@hidden>
Commit: Damien Cassou <address@hidden>

    Send Emacs text to GPaste when in a terminal
---
 gpastel.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gpastel.el b/gpastel.el
index 5889006..1074ae7 100644
--- a/gpastel.el
+++ b/gpastel.el
@@ -160,5 +160,26 @@ all text in the GPaste clipboard."
       (gpastel--start-listening)
     (gpastel--stop-listening)))
 
+(cl-defmethod gui-backend-set-selection (selection-symbol value
+                                                          &context 
(window-system nil))
+  (if (not (and gpastel-mode (eq selection-symbol 'CLIPBOARD)))
+      (cl-call-next-method)
+    (gpastel-dbus-call #'dbus-call-method "Add" value)))
+
+;; BIG UGLY HACK!
+;; xterm.el has a defmethod to use some (poorly supported) escape
+;; sequences (code named OSC 52) for clipboard interaction, and enables
+;; it by default.
+;; Problem is, that its defmethod takes precedence over our defmethod,
+;; so we need to disable it in order to be called.
+(cl-defmethod gui-backend-set-selection :extra "gpastel-override"
+  (selection-symbol value
+                    &context (window-system nil)
+                    ((terminal-parameter nil 'xterm--set-selection) (eql t)))
+  ;; Disable this method which doesn't work anyway in 99% of the cases!
+  (setf (terminal-parameter nil 'xterm--set-selection) nil)
+  ;; Try again!
+  (gui-backend-set-selection selection-symbol value))
+
 (provide 'gpastel)
 ;;; gpastel.el ends here



reply via email to

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