Using this reddit post as inspiration, I am trying to create a screenshot-svg
command using the following config:
(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)))
However, when I try to run the screenshot-svg
command, I get the message let*: Symbol’s function definition is void: x-export-frames
, and nothing seems to happen. How do I check if x-export-frames
is available on my build? What do I need to do to get this working? Are there any other ways to get svg screenshots on emacs?
EDIT: I am using OSX, so I am also wondering if Cairo, or something similar is available for OSX?
M-x describe-function
(usually bound toC-hf
) and see ifx-export-frames
offers anything. What you need to do: compile emacs (version 27.1) with cairo support.x-export-frames
is not available on my system. I should have specified that I am running OSX (have updated question), and am trying to find out if it is possible to compile with cairo on OSX (or if there is an alternative)(fboundp 'x-export-frames)
. AFAIK there's no macOS build of Emacs with cairo.