2019-10-09 13:13:56 +02:00
|
|
|
;;; clipboard.el --- Working with X11's pasteboard -*- lexical-binding: t -*-
|
2020-09-01 11:17:43 +02:00
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;; Author: William Carroll <wpcarro@gmail.com>
|
2020-09-01 11:17:43 +02:00
|
|
|
;; Version: 0.0.1
|
|
|
|
;; Package-Requires: ((emacs "24.3"))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;; Simple functions for copying and pasting.
|
|
|
|
;;
|
|
|
|
;; Integrate with bburns/clipmon so that System Clipboard can integrate with
|
|
|
|
;; Emacs's kill-ring.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-09-02 15:39:41 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Dependencies
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2020-09-02 16:23:46 +02:00
|
|
|
(require 'cl-lib)
|
2020-09-02 15:39:41 +02:00
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Library
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2020-09-01 11:17:43 +02:00
|
|
|
(cl-defun clipboard-copy (x &key (message "[clipboard.el] Copied!"))
|
2020-09-02 16:23:46 +02:00
|
|
|
"Copy string, X, to X11's clipboard and `message' MESSAGE."
|
2019-10-09 13:13:56 +02:00
|
|
|
(kill-new x)
|
2020-01-16 20:18:11 +01:00
|
|
|
(message message))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-09-01 11:17:43 +02:00
|
|
|
(cl-defun clipboard-paste (&key (message "[clipboard.el] Pasted!"))
|
2020-09-02 16:23:46 +02:00
|
|
|
"Paste contents of X11 clipboard and `message' MESSAGE."
|
2019-10-09 13:13:56 +02:00
|
|
|
(yank)
|
2020-01-16 20:18:11 +01:00
|
|
|
(message message))
|
2019-10-09 13:13:56 +02:00
|
|
|
|
2020-09-01 11:17:43 +02:00
|
|
|
(defun clipboard-contents ()
|
2020-01-17 19:52:16 +01:00
|
|
|
"Return the contents of the clipboard as a string."
|
|
|
|
(substring-no-properties (current-kill 0)))
|
|
|
|
|
2019-10-09 13:13:56 +02:00
|
|
|
(provide 'clipboard)
|
|
|
|
;;; clipboard.el ends here
|