Kungsgeten / org-brain

Org-mode wiki + concept-mapping
MIT License
1.73k stars 104 forks source link

Stay the same button when select. #261

Closed tumashu closed 4 years ago

tumashu commented 4 years ago
Kungsgeten commented 4 years ago

Hi! I like the idea! However I wonder if this shouldn't be the default of org-brain--revert-if-visualizing? I made a version like this, which seems to work:

(defun org-brain--revert-if-visualizing ()
  "Revert buffer if in `org-brain-visualize-mode'."
  (when (eq major-mode 'org-brain-visualize-mode)
    (let ((button-entry-id (org-brain-entry-identifier
                            (car (org-brain-button-at-point)))))
      (org-brain-stop-wandering)
      (revert-buffer)
      (when button-entry-id
        (let ((char-target (point)))
          (goto-char (point-min))
          (search-forward "\n\n" nil t)
          (while (and (or (ignore-errors (forward-button 1))
                          (goto-char char-target))
                      (not (equal (button-get (button-at (point)) 'id)
                                  button-entry-id)))))))))

Maybe its nice to have the goto entry button as a function though.

tumashu commented 4 years ago

good idea too :-)

Kungsgeten commented 4 years ago

I made some modifications to the code above and commited it. I hope you don't mind. Thank you for the suggestion!

tumashu commented 4 years ago

:-) no problem, just just it.

At 2020-02-29 18:55:44, "Erik Sjöstrand" notifications@github.com wrote:

I made some modifications to the code above and commited it. I hope you don't mind. Thank you for the suggestion!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.