Hello all, First of all thanks to everybody for org (file, agenda, and much more), such an amazing tool!
I'm trying to add a minor "org-follow-mode" somewhere between "org-agenda-follow-mode" and "org-roam-ui-follow-mode" <https://github.com/org-roam/> (request also posted on <https://org-roam.discourse.group/t/advice-for-an-org-follow-mode-following-org-org-roam-links/3631>). My intuition so far was to start from a copy of "org-agenda-follow-mode" (and subcommands), adapting it to an org file being the main window. --8<---------------cut here---------------start------------->8--- (defvar org-follow-mode nil) (defvar org-pre-follow-window-conf nil) (defun org-marked-tree-to-indirect-buffer (arg) ;; TODO needed? ;; (interactive "P") ;; (org-agenda-check-no-diary) (let* ((marker ;;(or (org-get-at-bol 'org-marker) ;; (org-agenda-error) ;; ) ) (buffer (marker-buffer marker)) (pos (marker-position marker))) (with-current-buffer buffer (save-excursion (goto-char pos) (org-tree-to-indirect-buffer arg)))) ;; TODO needed? ;; (setq org-agenda-last-indirect-buffer org-last-indirect-buffer) ) (defcustom org-follow-indirect nil "Non-nil means `org-follow-mode' displays only the current item's tree, in an indirect buffer." :group 'org :version "29.4" :type 'boolean) (defun org-do-context-action () "Show outline path and, maybe, follow mode window." (let ((m (org-get-at-bol 'org-marker))) (when (and (markerp m) (marker-buffer m)) (and org-follow-mode (if org-follow-indirect (let ((org-indirect-buffer-display 'other-window)) ;; TODO or org-marked-tree-to-indirect-buffer from above (org-tree-to-indirect-buffer nil)) ;; TODO needed? ;; (org-agenda-show) ;; TODO ;; (and org-agenda-show-outline-path ;; (org-with-point-at m (org-display-outline-path org-agenda-show-outline-path))) ))))) (defun org-follow-mode () "Toggle follow mode in a buffer." (interactive) (unless org-follow-mode (setq org-pre-follow-window-conf (current-window-configuration))) (setq org-follow-mode (not org-follow-mode)) (unless org-follow-mode (set-window-configuration org-pre-follow-window-conf)) ;; TODO needed? ;; (org-set-mode-name) (org-do-context-action) (message "Follow mode is %s" (if org-follow-mode "on" "off"))) --8<---------------cut here---------------end--------------->8--- Now this obviously doesn't work, primarily because I have no `org-marker` defined as no agenda line is selected. I then went over the "org-roam-ui-follow-mode" code, little of which I could use for this as most of the follow-mode looks simpler, directly using the network instead of having to manage windows. Would anyone have some advice to set this up? How to replace the use of `marker` and read the current org position instead? Thanks again for reading, and best to y'all -- Sébastien Lerique https://slvh.fr/