Add SVG screenshot function

This commit is contained in:
Antoine Martin 2020-12-25 22:56:15 +01:00
parent ecff140c8d
commit 04c85f3386

View file

@ -3,6 +3,7 @@
- [[#misc][Misc]]
- [[#lexical-bindings][Lexical bindings]]
- [[#dir-local-variables][Dir local variables]]
- [[#taking-svg-screenshots][Taking SVG screenshots]]
- [[#theme][Theme]]
- [[#main-theme][Main theme]]
- [[#dark-theme-toggle][Dark theme toggle]]
@ -57,6 +58,24 @@ some projects.
(setq enable-dir-local-variables nil)
#+END_SRC
** Taking SVG screenshots
Since Emacs 27, we can take SVG screenshots! Emacs needs to be built with
=cairo= to support this.
#+begin_src emacs-lisp
(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)))
#+end_src
* Theme
** Main theme