Skip to content

Instantly share code, notes, and snippets.

@xcodebuild
Created August 8, 2015 12:39
Show Gist options
  • Save xcodebuild/5f1f17fee8c11b4f3348 to your computer and use it in GitHub Desktop.
Save xcodebuild/5f1f17fee8c11b4f3348 to your computer and use it in GitHub Desktop.
Take a screenshot and insert in emacs(Mac only)
(defun my-org-screenshot ()
"Take a screenshot into a time stamped unique-named file in the
same directory as the org-buffer and insert a link to this file."
(interactive)
(setq filename
(concat
(make-temp-name
(concat
"art/"
(buffer-name)
"_"
(format-time-string "%Y%m%d_%H%M%S_")) ) ".png"))
(call-process-shell-command "screencapture" nil nil nil "-s -t png" filename)
(insert (concat "[[file:" filename "]]"))
(org-redisplay-inline-images)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment