Last active
November 4, 2021 20:17
-
-
Save nobiot/5a54f89242a857e2206eabbfea3935fa to your computer and use it in GitHub Desktop.
my/org-writing-mode: https://org-roam.discourse.group/t/turn-off-the-bright-meta/2174/6?u=nobiot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;###autoload | |
(defun my/mode-line-hide () | |
(interactive) | |
(setq-local mode-line-format nil)) | |
;;;###autoload | |
(defun my/mode-line-show () | |
(interactive) | |
(kill-local-variable 'mode-line-format) | |
(force-mode-line-update)) | |
;; Source | |
;; https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2#hiding-the-properties-drawer | |
(defun my/org-hide-properties () | |
"Hide all org-mode headline property drawers in buffer. Could be slow if it has a lot of overlays." | |
(interactive) | |
(save-excursion | |
(goto-char (point-min)) | |
(while (re-search-forward | |
"^ *:properties:\n\\( *:.+?:.*\n\\)+ *:end:\n" nil t) | |
(let ((ov_this (make-overlay (match-beginning 0) (match-end 0)))) | |
(overlay-put ov_this 'display "") | |
(overlay-put ov_this 'hidden-prop-drawer t)))) | |
(put 'org-toggle-properties-hide-state 'state 'hidden)) | |
(defun my/org-show-properties () | |
"Show all org-mode property drawers hidden by org-hide-properties." | |
(interactive) | |
(remove-overlays (point-min) (point-max) 'hidden-prop-drawer t) | |
(put 'org-toggle-properties-hide-state 'state 'shown)) | |
(defun my/org-toggle-properties () | |
"Toggle visibility of property drawers." | |
(interactive) | |
(if (eq (get 'org-toggle-properties-hide-state 'state) 'hidden) | |
(org-show-properties) | |
(org-hide-properties))) | |
;; Source | |
;; https://www.reddit.com/r/emacs/comments/estlwh/possibility_of_making_the_org_mode_less_ugly/ | |
(defun my/org-pretty-symbols-mode () | |
(push '("#+title: " . "") prettify-symbols-alist) | |
(push '("#+subtitle: " . "") prettify-symbols-alist) | |
(push '("#+filetags: " . "") prettify-symbols-alist) | |
(push '("* " . "") prettify-symbols-alist) | |
(push '("** " . "") prettify-symbols-alist) | |
(push '("*** " . "") prettify-symbols-alist) | |
(push '("**** " . "") prettify-symbols-alist) | |
(push '("***** " . "") prettify-symbols-alist) | |
(push '("#+author: " . "- ") prettify-symbols-alist) | |
(push '(":properties:" . ":") prettify-symbols-alist) | |
(push '(":PROPERTIES:" . ":") prettify-symbols-alist) | |
(push '("#+begin_src" . "»") prettify-symbols-alist) | |
(push '("#+end_src" . "«") prettify-symbols-alist) | |
(push '("#+results:" . "∴") prettify-symbols-alist) | |
(push '(":end:" . ":") prettify-symbols-alist) | |
(push '(":END:" . ":") prettify-symbols-alist) | |
(push '(":results:" . "∴") prettify-symbols-alist) | |
(push '("#+name:" . "-") prettify-symbols-alist) | |
(push '("#+begin_example" . "~") prettify-symbols-alist) | |
(push '("#+end_example" . "~") prettify-symbols-alist) | |
(push '("#+begin_quote" . "«") prettify-symbols-alist) | |
(push '("#+end_quote" . "»") prettify-symbols-alist) | |
(push '("#+tblfm:" . "∫") prettify-symbols-alist) | |
(push '("[X]" . (?\[ (Br . Bl) ?✓ (Br . Bl) ?\])) prettify-symbols-alist) | |
(push '("\\\\" . "↩") prettify-symbols-alist) | |
(prettify-symbols-mode t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-minor-mode my/org-writing-mode | |
"Toggle my personal org-writing minor mode. | |
Interactively with no argument, this command toggles the mode. | |
A positive prefix argument enables the mode, any other prefix | |
argument disables it. From Lisp, argument omitted or nil enables | |
the mode, `toggle' toggles the state." | |
:init-value nil | |
:lighter nil | |
:global nil | |
(cond | |
(my/org-writing-mode | |
(setq-local org-hide-emphasis-markers t) | |
;; Need to toggle font-lock to change the emaphasis marker on display | |
(font-lock-fontify-buffer t) | |
(org-num-mode 1) | |
(variable-pitch-mode 1) | |
(menu-bar-mode -1) | |
(my/mode-line-hide) | |
(my/org-pretty-symbols-mode) | |
(my/org-hide-properties)) | |
(t | |
(setq-local org-hide-emphasis-markers nil) | |
;; Need to toggle font-lock to change the emaphasis marker on display | |
(font-lock-fontify-buffer t) | |
(org-num-mode -1) | |
(variable-pitch-mode -1) | |
(menu-bar-mode 1) | |
(my/mode-line-show) | |
(prettify-symbols-mode -1) | |
(my/org-show-properties)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment