Skip to content

Instantly share code, notes, and snippets.

@praetoriansentry
Created October 31, 2023 12:11
Show Gist options
  • Save praetoriansentry/439d50a39e8a033ad892511199977e24 to your computer and use it in GitHub Desktop.
Save praetoriansentry/439d50a39e8a033ad892511199977e24 to your computer and use it in GitHub Desktop.
Emacs Org Mode paste current image clipboard as file
(defun paste-current-image ()
"Assume the current clipboard contains and image and paste it into the org file"
(interactive)
(setq filename
(concat
(make-temp-name
(concat (buffer-file-name)
"_"
(format-time-string "%Y%m%d_%H%M%S_")) ) ".png"))
(call-process "xclip" nil (list :file filename) nil "-selection" "clipboard" "-t" "image/png" "-o")
(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