awth13 / org-appear

Toggle visibility of hidden Org mode element parts upon entering and leaving an element
MIT License
383 stars 19 forks source link

README.org is a bit misleading #45

Closed hpgisler closed 2 years ago

hpgisler commented 2 years ago

The README states:

The manual option is useful for, e.g., integrating org-appear with evil-mode. Below is an example configuration for toggling elements in Insert mode only.

(setq org-appear-trigger 'manual)
(add-hook 'evil-insert-state-entry-hook #'org-appear-manual-start nil t)
(add-hook 'evil-insert-state-exit-hook #'org-appear-manual-stop nil t)

HOWEVER:

It would be good to additionally note, that this hook definition is buffer local, i.e. add-hook needs executed for each opened org buffer.

E.g. if using use-package, this would look as following:

(use-package org-appear
    ...
    :hook (org-mode . (lambda ()
                    (org-appear-mode t)
                    (add-hook 'evil-insert-state-entry-hook #'org-appear-manual-start nil t)
                    (add-hook 'evil-insert-state-exit-hook #'org-appear-manual-stop nil t)))
    ...
awth13 commented 2 years ago

Thank you for pointing this out. You are absolutely right and I clarified the README accordingly.