1 (defvar my/fringe-width 6)
3 (defconst my/script-dir
4 (file-name-directory (or load-file-name
8 (dolist (buffer (buffer-list))
11 (defun my/prepare-UI ()
12 "Prepare UI for taking a screenshot."
18 (fringe-mode (cons my/fringe-width my/fringe-width))
19 (blink-cursor-mode -1)
20 (setq-default cursor-type 'bar
21 split-width-threshold 80
22 truncate-partial-width-windows t
23 frame-title-format (format "Compact docstrings @ Emacs %s" emacs-version)
24 x-gtk-use-system-tooltips nil)
26 ;; (set-face-attribute 'tooltip nil :height 60)
27 (set-face-attribute 'match nil :background "yellow1")
28 (set-face-attribute 'default nil :family "Ubuntu Mono" :height 110)
29 (set-face-attribute 'mode-line nil :foreground "gray60" :background "black")
30 (set-face-attribute 'mode-line-inactive nil :foreground "gray60" :background "#404045")
31 (set-face-attribute 'mode-line-buffer-id nil :foreground "#eab700")
32 (set-fontset-font t 'unicode "Ubuntu Mono")
33 (set-frame-size nil 100 13)
36 (defun my/load-package ()
39 (load-library "compact-docstrings"))
41 (defun my/load-example ()
42 "Prepare files and layout windows."
43 (find-file "etc/before.py")
44 (setq buffer-name "Regular docstrings")
45 (find-file-other-window "after.py")
46 (setq buffer-name "Compact docstrings")
47 (compact-docstrings-mode))
49 (defun my/prepare-screenshot-1 ()
50 "Prepare for taking a screenshot."
56 (defun my/save-screenshot ()
57 "Save screenshot of current frame."
58 (let ((fname (expand-file-name "compact-docstrings.png" my/script-dir)))
59 (process-lines "import" "-window" (frame-parameter nil 'outer-window-id)
61 (process-lines "mogrify" "-strip" "-matte"
62 "-bordercolor" (face-attribute 'fringe :background)
63 "-border" (format "0x%d" my/fringe-width) fname)
64 (process-lines "optipng" "-o3" fname))
67 (defun my/take-screenshot ()
68 (my/prepare-screenshot-1)
70 (run-with-idle-timer 1 nil #'my/save-screenshot))
72 (print default-directory)
73 (run-with-idle-timer 0 nil #'my/take-screenshot)