add idea of distraction free view
This commit is contained in:
@@ -7,6 +7,45 @@
|
||||
(add-hook 'org-mode-hook 'my-org-link-color-hook)
|
||||
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr)))
|
||||
|
||||
(use-package olivetti
|
||||
:commands (olivetti-mode)
|
||||
:bind (("<f8>" . my-distraction-free))
|
||||
:config
|
||||
(defun my-distraction-free ()
|
||||
"Distraction-free writing environment."
|
||||
(interactive)
|
||||
(if (equal olivetti-mode nil)
|
||||
(progn
|
||||
(window-configuration-to-register 1)
|
||||
(delete-other-windows)
|
||||
(when (equal major-mode 'org-mode)
|
||||
(when (and (featurep 'org-superstar)
|
||||
(equal org-superstar-mode t))
|
||||
;; remove leading stars
|
||||
(setq my-last-org-hide-leading-stars org-hide-leading-stars)
|
||||
(setq org-hide-leading-stars nil) ;; must be nil! hiding via `org-superstar-remove-leading-stars'
|
||||
(setq my-last-org-superstar-remove-leading-stars org-superstar-remove-leading-stars)
|
||||
(setq org-superstar-remove-leading-stars t)
|
||||
(org-superstar-restart)
|
||||
)
|
||||
(setq my-last-org-num-mode org-num-mode)
|
||||
(unless org-num-mode (org-num-mode))
|
||||
)
|
||||
(olivetti-mode t))
|
||||
(progn
|
||||
(jump-to-register 1)
|
||||
;; reset to last state
|
||||
(when (equal major-mode 'org-mode)
|
||||
(when (and (featurep 'org-superstar)
|
||||
(equal org-superstar-mode t))
|
||||
(setq org-hide-leading-stars my-last-org-hide-leading-stars)
|
||||
(setq org-superstar-remove-leading-stars my-last-org-superstar-remove-leading-stars)
|
||||
(org-superstar-restart)
|
||||
)
|
||||
(unless my-last-org-num-mode (org-num-mode -1))
|
||||
)
|
||||
(olivetti-mode 0)))))
|
||||
|
||||
(use-package my-org-article
|
||||
:after (org)
|
||||
:config
|
||||
|
||||
Reference in New Issue
Block a user