frankjonen

Emacs: Toggle an outline element to a new window

Jul 1st, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.55 KB | None | 0 0
  1. (defun split-and-indirectbuffer-orgtree ()
  2. "Splits current window to the right and opens the selected section in it as an indirect buffer"
  3. (interactive)
  4. (split-window-right)
  5. (org-tree-to-indirect-buffer)
  6. (windmove-right))
  7.  
  8. (defun kill-and-unsplit-indirectbuffer-orgtree ()
  9. "Kills the indirect buffer and deletes the window."
  10. (interactive)
  11. (kill-this-buffer)
  12. (delete-window))
  13.  
  14. (with-eval-after-load 'org
  15.     (define-key org-mode-map [f9] #'split-and-indirectbuffer-orgtree)
  16.     (define-key org-mode-map [f12] #'kill-and-unsplit-indirectbuffer-orgtree))
Advertisement
Add Comment
Please, Sign In to add comment