(defun bug41810-setup () (require 'adaptive-wrap) (add-hook 'visual-line-mode-hook 'adaptive-wrap-prefix-mode) (setq-default adaptive-wrap-extra-indent 2) (setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) (global-visual-line-mode)) (defun bug41810-teardown (screenshot) (text-scale-increase 2) ;; AFAICT unless we force redisplay, ImageMagick only captures the ;; *scratch* buffer. ;; Also, sometimes the scroll bar refuses to be drawn. I've tried ;; various permutations of sit-for, redraw-frame, redraw-display, ;; force-window-updateโ€ฆ The following is the most "robust" way I ;; found to have the scroll bar show up and smile for the camera. ;; tl;dr I have no idea what I'm doing ๐Ÿ’ป๐Ÿพ๐Ÿ‘”๐Ÿ• (redisplay) (sleep-for 0.1) (redisplay) (call-process "magick" nil nil nil "import" "-window" (frame-parameter (selected-frame) 'window-id) "-frame" (expand-file-name (concat (buffer-local-value 'default-directory (get-buffer "*scratch*")) screenshot))) (kill-emacs)) (defmacro defexample-bug41810 (name &rest body) (declare (indent defun)) (list 'defun (intern (format "bug41810-%s" name)) '(description) '(bug41810-setup) `(progn ,@body) `(bug41810-teardown (format "%s-%s.png" ,(symbol-name name) description)))) (defexample-bug41810 nospace-1 (find-library "cl-indent") (goto-char (point-max)) (recenter -1)) (defexample-bug41810 nospace-2 (switch-to-buffer "*example*") (url-insert-file-contents "https://code.orgmode.org/bzg/worg/raw/master/worgmap.org") (org-mode)) (defexample-bug41810 diff-1 (switch-to-buffer "*example*") (url-insert-file-contents "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=be5d0c0f63081b5aee5efe2fbcc5c4ace6ca9a02") (diff-mode) (search-forward "diff --git") (recenter 0)) (defexample-bug41810 diff-2 (switch-to-buffer "*example*") (url-insert-file-contents "https://git.savannah.gnu.org/cgit/emacs.git/patch/?id=be5d0c0f63081b5aee5efe2fbcc5c4ace6ca9a02") (diff-mode) (set-face-background 'diff-indicator-added (face-background 'default)) (set-face-background 'diff-indicator-removed (face-background 'default)) (search-forward "diff --git") (recenter 0))