Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Take screeeshot from Emacs
(defun screenshot-frame ()
"Take screenshot.
Default image ~/screenshots/TIMESTAMP.png
M-x screenshot-frame
Enter custom-name or RET to save image with timestamp"
(let* ((insert-default-directory t)
(screenshots-dir "~/screenshots/")
(sframe-name (concat (format-time-string "%d-%b-%Y-%T") ".png"))
(read-file-name "Screenshot name: " screenshots-dir
(concat screenshots-dir sframe-name))))
(if (not (file-accessible-directory-p screenshots-dir))
(make-directory-internal screenshots-dir))
(concat "import " sframe-full-path))
(message "Screenshot saved as %s" sframe-full-path)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.