Skip to content

Instantly share code, notes, and snippets.

@fikovnik
Created December 14, 2018 14:25
Show Gist options
  • Save fikovnik/e0fa86aea29f761b6a4ddcfda463413b to your computer and use it in GitHub Desktop.
Save fikovnik/e0fa86aea29f761b6a4ddcfda463413b to your computer and use it in GitHub Desktop.
org-insert-clipboard-image
(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