Last active
December 12, 2015 08:25
-
-
Save psachin/6e42d303bc54a5d38798 to your computer and use it in GitHub Desktop.
Take screeeshot from Emacs
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 screenshot-frame () | |
"Take screenshot. | |
Default image ~/screenshots/TIMESTAMP.png | |
Usage: | |
M-x screenshot-frame | |
Enter custom-name or RET to save image with timestamp" | |
(interactive) | |
(let* ((insert-default-directory t) | |
(screenshots-dir "~/screenshots/") | |
(sframe-name (concat (format-time-string "%d-%b-%Y-%T") ".png")) | |
(sframe-full-path | |
(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)) | |
(shell-command-to-string | |
(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