I like to clone-indirect-buffer
. But then once in a while, I want to move to the other buffer and go to the same position as in the previous marker.
This is usually the case when I use the indirect buffer as an 'outline' and want to s-mouse-1
to move the other buffer to the same spot.
I tried to hack together the following:
(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)
(org-reveal))
)
But it doesn't work properly if the other buffer's content isn't fully expanded. I.e it doesn't jump into content that is collapsed.
[edit]
org-reveal
did the job. (added to the code above).
Can the above be modified so that it expands sections properly if they are not expanded?
[edit2]
This may be of interest to future readers. In this post it dissucsses a dynamic TOC where I use the function above as well as another function that first finds the other buffer. You might want to check it out.