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."
  (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?

  • 1
    How do do you check: do M-x describe-function (usually bound to C-hf) and see if x-export-frames offers anything. What you need to do: compile emacs (version 27.1) with cairo support. Dec 9, 2020 at 9:10
  • Thanks @FranBurstall - yes, I can now confirm that 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)
    – Fergie
    Dec 9, 2020 at 10:14
  • 1
    You can check if the function is available using (fboundp 'x-export-frames). AFAIK there's no macOS build of Emacs with cairo.
    – Clément
    Dec 11, 2020 at 21:12

1 Answer 1


As of 2021-11-25 I only have sad news here:

While cairo works on macOS via brew install cairo just fine, I didn't find a way to make any of the Emacs builds aware of it. Tried emacs-plus@28 and emacs-head@28 and the build-emacs-for-macos script, but even with X11 support, the x-export-frames function isn't available.

Other x- prefixed functions exist, but no luck with the SVG saving thus far.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.