I like using org-mode as a distraction free text editor.
I also like using org-indent-mode when navigating my entire file.
I also like using
org-tree-to-indirect-buffer to focus on a desired section of text. Doing this makes org-indent-mode rather unnecessary however, as I'm usually working at the lowest level and thus the indent is just empty space where I could have more text on the screen.
After turning off org-indent-mode manually for a while I tried to come up with a single shortcut to toggle both commands at once.
;; custom org to indirect buffer, toggling off indent-mode for the new indirect buffer (defun my-org-to-indirect-buffer () "Run `some-command' and `some-other-command' in sequence." (interactive) (org-tree-to-indirect-buffer) (org-indent-mode) ) (global-set-key (kbd "C-f") 'my-org-to-indirect-buffer)
Not only does this fail to toggle off org-indent-mode in the indirect buffer, it also messes with the original buffer, so I have to manually toggle org-indent-mode off and on before it works again. I get this happens because the second command triggers after killing the indirect buffer, yet it doesn't behave as I'd expect and just turn off the mode, as my mode-line still displays it running. Clearly there's something going on I'm missing.
How would I open an indirect buffer and toggle off org-indent-mode in a single keypress, with a second keypress undoing the changes, reverting back to my main buffer with org-indent-mode on?