-
Notifications
You must be signed in to change notification settings - Fork 0
/
macos-clipboard.el
34 lines (26 loc) · 980 Bytes
/
macos-clipboard.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;; macos-clipboard.el --- Communicate with macOS pasteboard server
;; Copyright (C) 2023 Hanyuan Li
;; Author: Hanyuan Li <[email protected]>
;; URL: https://github.com/citrus-lemon/emacs-macos-clipboard
;; Keywords: clipboard macos
;; Version: 1.0.0
;;; Commentary:
;;
;; communicate with macOS pasteboard server
;;
;;; Code:
(require 'macos-clipboard-nspasteboard)
(defun macos-clipboard-extract-pasteboard (&optional types)
(if types
(if (eq types 'only-types)
(macos-clipboard--extract-pasteboard-only-types)
(let ((result (macos-clipboard--extract-pasteboard-with-types (if (listp types) types (list types)))))
;; HACK: avoid result of '(nil)
(if (equal result '(nil))
nil
result)))
(macos-clipboard--extract-pasteboard)))
(defun macos-clipboard-set-string (value &optional type)
(macos-clipboard--set-string value type))
(provide 'macos-clipboard)
;;; macos-clipboard.el ends here