When I edit large documents, I would like to see where I'm at by seeing the outline (with no-content) in a separate buffer. Like when you read a PDF file there is a TOC on the left. (see below)
In org-mode it's possible to expand/collapse outline. But is it possible to have a static outline in the left(or right) in a separate buffer so that when you click on the headings, the other buffer moves to that position?
Kinda like this but for org-mode?
clone-indirect-buffer is very close to what I want. The missing piece of the puzzle is to jump to the same location when clicking a heading/(or any point really).
For this I have tried to write some code: Move to other cloned buffer to same point? (sync position of indirect buffers) (org-mode)
But it doesn't function if content is collapsed. If that can be made to work, then the clone-inderect-buffer is a complete solution to this.
The code in the link above and in the answer below combine niceley to solve the jumping back and forth.
;first call 'clone-indirect-buffer'. Then... ;This function works between buffer and it's clone. (defun my/goto-same-spot-in-other-buffer () "Go to the same location in the other buffer. Useful for when you have cloned indirect buffers" (interactive) (let ((my/goto-current-point (point))) (other-window 1) (goto-char my/goto-current-point) (when (invisible-p (point)) (org-reveal))) ) ;This function is a clone-to-buffer jump only: ; It does find the other buffer first thou instead of just jumping to the other ; window as does the function above. (defun my/jump-to-point-and-show () "Switch to a cloned buffer's base buffer and move point to the cursor position in the clone." (interactive) (let ((buf (buffer-base-buffer))) (unless buf (error "You need to be in a cloned buffer!")) (let ((pos (point)) (win (car (get-buffer-window-list buf)))) (if win (select-window win) (other-window 1) (switch-to-buffer buf)) (goto-char pos) (when (invisible-p (point)) (show-branches))))) (global-set-key (kbd "<s-mouse-1>") 'my/goto-same-spot-in-other-buffer) (global-set-key (kbd "s-m") 'my/goto-same-spot-in-other-buffer) (global-set-key (kbd "<C-s-mouse-1>") 'my/jump-to-point-and-show) (global-set-key (kbd "C-s-m") 'my/jump-to-point-and-show)