~protesilaos/logos

d618202372ea49b566ef875a60670d5fe34ad4b0 — Protesilaos Stavrou 1 year, 2 months ago eeedd3e
Simplify the example with org-indent-mode
1 files changed, 5 insertions(+), 23 deletions(-)

M README.org
M README.org => README.org +5 -23
@@ 499,32 499,14 @@ use the ~logos-focus-mode-hook~ instead.
Here is a snippet that relies on the ~logos-focus-mode-hook~ to extend
the functionality of ~logos-focus-mode~ ([[#h:a2540f2f-1159-4e5c-a486-e1f2cb63fee8][Leverage logos-focus-mode-hook]]).

#+begin_src emacs-lisp
(defvar my-logos-org-indent nil
  "When t, disable `org-indent-mode' during `logos-focus-mode'.")

(defun my-logos-org-indent ()
  "Set `my-logos-org-indent' in `logos-focus-mode'."
  (when my-logos-org-indent
    ;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
    ;; restore it when `logos-focus-mode' is disabled.  The
    ;; `logos-set-mode-arg' function takes care of the technicalities.
    (logos-set-mode-arg 'org-indent-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-org-indent)
#+end_src

The ~my-logos-org-indent~ variable lets the user opt in and out of this
feature, by setting it to t or nil, respectively.  If such a toggle is
not needed, the following will suffice:
It disables ~org-indent-mode~ when ~logos-focus-mode~ is enabled and
restores it when ~logos-focus-mode~ is disabled.  The
~logos-set-mode-arg~ function takes care of the technicalities.

#+begin_src emacs-lisp
(defun my-logos-org-indent ()
  "Set `my-logos-org-indent' in `logos-focus-mode'."
  ;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
  ;; restore it when `logos-focus-mode' is disabled.  The
  ;; `logos-set-mode-arg' function takes care of the technicalities.
  (logos-set-mode-arg 'org-indent-mode -1))
  (when logos-focus-mode
    (logos-set-mode-arg 'org-indent-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-org-indent)
#+end_src