Created
October 31, 2023 12:11
-
-
Save praetoriansentry/439d50a39e8a033ad892511199977e24 to your computer and use it in GitHub Desktop.
Emacs Org Mode paste current image clipboard as file
This file contains 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 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