Skip to content

Instantly share code, notes, and snippets.

@shapr
Created February 25, 2021 19:10
Show Gist options
  • Save shapr/71e1019f2fcf722e57e8672fd725d0e5 to your computer and use it in GitHub Desktop.
Save shapr/71e1019f2fcf722e57e8672fd725d0e5 to your computer and use it in GitHub Desktop.
;; useful trick from https://www.reddit.com/r/emacs/comments/idz35e/emacs_27_can_take_svg_screenshots_of_itself/
(defun screenshot-svg ()
"Save a screenshot of the current frame as an SVG image.
Saves to a temp file and puts the filename in the kill ring."
(interactive)
(let* ((filename (make-temp-file "Emacs" nil ".svg"))
(data (x-export-frames nil 'svg)))
(with-temp-file filename
(insert data))
(kill-new filename)
(message filename)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment