Created
December 14, 2018 14:25
-
-
Save fikovnik/e0fa86aea29f761b6a4ddcfda463413b to your computer and use it in GitHub Desktop.
org-insert-clipboard-image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun org-insert-clipboard-image () | |
(interactive) | |
(setq dir (concat (file-name-directory (buffer-file-name)) "resources")) | |
(unless (file-directory-p dir) (make-directory dir)) | |
(setq filename | |
(concat dir | |
"/" | |
(file-name-nondirectory (file-name-sans-extension (buffer-file-name))) | |
"-" | |
(format-time-string "%Y%m%d-%H%M%S") | |
".png")) | |
(shell-command (concat " xclip -selection clipboard -t image/png -o > " filename)) | |
(insert (concat "[[" filename "]]")) | |
(org-display-inline-images)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment