Skip to content

Instantly share code, notes, and snippets.

@cpbotha
Last active January 28, 2022 13:56

Revisions

  1. cpbotha revised this gist Jan 28, 2022. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions init.el
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    ;; as of 2021-12-19 with latest master pgtk emacs on non-store WSL I can copy
    ;; text from other apps into Emacs, but I can't copy text from Emacs into other
    ;; apps, and so I use this work-around with wl-copy. original value of
    ;; interprogram-cut-function was gui-select-text
    ;; apps, and so I use this work-around with wl-copy.
    ;; original value of interprogram-cut-function was gui-select-text.
    ;; you need to have the wl-clipboard package installed for the wl-copy tool.
    ;; update 2022-01-28: this work-around still required with WSL 0.51.2.0
    (when (getenv "WAYLAND_DISPLAY")
    (setq
    interprogram-cut-function
  2. cpbotha revised this gist Dec 19, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion init.el
    Original file line number Diff line number Diff line change
    @@ -11,4 +11,4 @@
    ;; clipboard, but not when it's invoked from this context.
    ;; (gui-set-selection 'CLIPBOARD text)
    ;; without the charset=utf-8 in type, emacs / wl-copy will crash when you paste emojis into a windows app
    (start-process "wl-copy" nil "wl-copy" "--foreground" "--trim-newline" "--type" "text/plain;charset=utf-8" text))))
    (start-process "wl-copy" nil "wl-copy" "--trim-newline" "--type" "text/plain;charset=utf-8" text))))
  3. cpbotha revised this gist Dec 19, 2021. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions init.el
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,9 @@
    (setq
    interprogram-cut-function
    (lambda (text)
    ;; strangest thing: gui-select-text leads to (gui-set-selection 'CLIPBOARD
    ;; text) -- if I eval that with some string, it mostly lands on the wayland
    ;; strangest thing: gui-select-text leads to gui-set-selection 'CLIPBOARD
    ;; text -- if I eval that with some string, it mostly lands on the wayland
    ;; clipboard, but not when it's invoked from this context.
    ;; (gui-set-selection 'CLIPBOARD text)
    (start-process "wl-copy" nil "wl-copy" "--foreground" "--trim-newline" text))))
    ;; without the charset=utf-8 in type, emacs / wl-copy will crash when you paste emojis into a windows app
    (start-process "wl-copy" nil "wl-copy" "--foreground" "--trim-newline" "--type" "text/plain;charset=utf-8" text))))
  4. cpbotha revised this gist Dec 19, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions init.el
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@
    (setq
    interprogram-cut-function
    (lambda (text)
    ;; strangest thing: gui-select-text leads to gui-set-selection 'CLIPBOARD
    ;; text -- if I eval that with some string, it mostly lands on the wayland
    ;; strangest thing: gui-select-text leads to (gui-set-selection 'CLIPBOARD
    ;; text) -- if I eval that with some string, it mostly lands on the wayland
    ;; clipboard, but not when it's invoked from this context.
    ;; (gui-set-selection 'CLIPBOARD text)
    (start-process "wl-copy" nil "wl-copy" "--foreground" "--trim-newline" text))))
  5. cpbotha created this gist Dec 19, 2021.
    13 changes: 13 additions & 0 deletions init.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    ;; as of 2021-12-19 with latest master pgtk emacs on non-store WSL I can copy
    ;; text from other apps into Emacs, but I can't copy text from Emacs into other
    ;; apps, and so I use this work-around with wl-copy. original value of
    ;; interprogram-cut-function was gui-select-text
    (when (getenv "WAYLAND_DISPLAY")
    (setq
    interprogram-cut-function
    (lambda (text)
    ;; strangest thing: gui-select-text leads to gui-set-selection 'CLIPBOARD
    ;; text -- if I eval that with some string, it mostly lands on the wayland
    ;; clipboard, but not when it's invoked from this context.
    ;; (gui-set-selection 'CLIPBOARD text)
    (start-process "wl-copy" nil "wl-copy" "--foreground" "--trim-newline" text))))