atykhonov/google-translate

Copy result to clipboard

matheusfillipe opened this issue · 2 comments

I think it would be nice or desirable to optionally store the translation result to the clipboard. On linux I am currently doing that with this patch:

diff --git a/google-translate-core-ui.el b/google-translate-core-ui.el
index 9752409..17fb193 100644
--- a/google-translate-core-ui.el
+++ b/google-translate-core-ui.el
@@ -813,6 +813,7 @@ http://www.gnu.org/software/emacs/manual/html_node/elisp/The-Echo-Area.html)"
         (target-language (gtos-target-language gtos))
         (auto-detected-language (gtos-auto-detected-language gtos))
         (text (gtos-text gtos)))
+    (gui-set-selection 'CLIPBOARD translation)
     (insert
      (google-translate--translation-title gtos "Translate from %s to %s:\n")
      "\n"
  1. Not just Emacs GUI clipboard support, you might consider also support Emacs clipboard API clipboard-kill-region.
  2. Also, I think this might is not just the only function to add support for this.
  3. I suggest you fork and create Pull Request for your patch. That will be more simpler.

👍 This would be very useful.