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]] - [[#misc][Misc]]
- [[#lexical-bindings][Lexical bindings]] - [[#lexical-bindings][Lexical bindings]]
- [[#dir-local-variables][Dir local variables]] - [[#dir-local-variables][Dir local variables]]
- [[#taking-svg-screenshots][Taking SVG screenshots]]
- [[#theme][Theme]] - [[#theme][Theme]]
- [[#main-theme][Main theme]] - [[#main-theme][Main theme]]
- [[#dark-theme-toggle][Dark theme toggle]] - [[#dark-theme-toggle][Dark theme toggle]]
@ -57,6 +58,24 @@ some projects.
(setq enable-dir-local-variables nil) (setq enable-dir-local-variables nil)
#+END_SRC #+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 * Theme
** Main theme ** Main theme