Indirect buffers

Inspired by a post found on the excellent Emacs news curated by Sasha Chua (Replacing Scrivener with Emacs and Vim), I decided to give indirect buffers another try.

Indirect buffers are buffers that share text with another buffer (the base buffer); org-mode, for example, allows the user to display a subtree in a indirect buffer, which might be a convenient way to focus on a particular section of a document.

Convenient but not practical to me, as I keep forgetting the combination used to open that indirect buffer (C-c C-x b), plus the cursor does not move where I'd want it. Here some code I borrowed from the configuration presented in the post: it is very simple, and in my opinion it makes the usage of indirect buffers a lot more pleasant:

(defun open-subtree-in-another-window ()
  (interactive)
  (org-tree-to-indirect-buffer)
  (windmove-right))

(global-set-key (kbd "C-M-l") 'open-subtree-in-another-window)