Skip to content

Instantly share code, notes, and snippets.

@sw1nn
Last active September 1, 2022 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw1nn/165a0d36b67e02d4a4d470473adc64cc to your computer and use it in GitHub Desktop.
Save sw1nn/165a0d36b67e02d4a4d470473adc64cc to your computer and use it in GitHub Desktop.
(defvar-local sw1nn/adoc-remappings nil)
(defcustom sw1nn/adoc-hide-faces
'(markup-meta-face markup-meta-hide-face)
"faces to hide in adoc"
:group 'sw1nn
:type 'list
)
(defun sw1nn/adoc-hide-meta-characters ()
(interactive)
(message "hiding adoc meta characters")
(when (derived-mode-p 'adoc-mode)
(dolist (face sw1nn/adoc-hide-faces)
(push (face-remap-add-relative face :height 0.1) sw1nn/adoc-remappings))))
(defun sw1nn/adoc-show-meta-characters ()
(interactive)
(message "showing adoc meta characters")
(when (derived-mode-p 'adoc-mode)
(dolist (remapping sw1nn/adoc-remappings)
(face-remap-remove-relative (pop sw1nn/adoc-remappings)))))
(defun sw1nn/adoc-toggle-meta-characters ()
(interactive)
(if sw1nn/adoc-remappings
(sw1nn/adoc-show-meta-characters)
(sw1nn/adoc-hide-meta-characters)))
(use-package adoc-mode
:mode ("\\.adoc\\'" . adoc-mode)
:hook ((adoc-mode . visual-line-mode)))
(advice-add #'view-mode :after (lambda (&rest r)
(when (derived-mode-p 'adoc-mode)
(bind-key "M" #'sw1nn/adoc-toggle-meta-characters view-mode-map)
(buffer-face-mode t)
(sw1nn/adoc-hide-meta-characters))))
(advice-add #'view-mode-exit :after (lambda (&rest r)
(when (derived-mode-p 'adoc-mode)
(buffer-face-mode -1)
(sw1nn/adoc-show-meta-characters))))
(deftheme sw1nn
"Created 2013-03-25.")
(custom-theme-set-faces
'sw1nn
'(default ((t (:family "Fira Code"))))
'(variable-pitch ((t (:background "ivory2" :foreground "gray10" :family "DejaVu Serif"))))
'(markup-gen-face ((t (:foreground "gray10"))))
'(markup-verbatim-face ((t nil)))
'(markup-title-0-face ((t (:inherit markup-gen-face :height 1.67))))
'(markup-title-1-face ((t (:inherit markup-gen-face :height 1.60))))
'(markup-title-2-face ((t (:inherit markup-gen-face :height 1.53))))
'(markup-title-3-face ((t (:inherit markup-gen-face :height 1.47))))
'(markup-title-4-face ((t (:inherit markup-gen-face :height 1.40))))
'(markup-title-5-face ((t (:inherit markup-gen-face :height 1.33))))
)
(provide 'sw1nn-theme)
;;; sw1nn-theme.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment