Skip to content

Instantly share code, notes, and snippets.

@shapr
Created November 25, 2024 20:30
Show Gist options
  • Save shapr/51e046aaf4cca0c9423bc02977ace469 to your computer and use it in GitHub Desktop.
Save shapr/51e046aaf4cca0c9423bc02977ace469 to your computer and use it in GitHub Desktop.
emacs can write out an SVG of the current frame, but requires X11 !
(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)))
(define-key global-map [(super s)] 'screenshot-svg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment