ace-link icon indicating copy to clipboard operation
ace-link copied to clipboard

[feature request] support for `org-roam-mode`

Open benthamite opened this issue 9 months ago • 0 comments

Would it be possible to support org-roam-mode? I noticed that ace-link-org correctly detects links in an org-roam-mode buffer (the buffer that is created when one runs e.g. org-roam-buffer-toggle). But because ace-link-org tries to open the link with org-open-at-point, it fails with the error

org-element-at-point: ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *org-roam*> (org-roam-mode)

The function needed to open links in an org-roam-mode buffer is org-roam-preview-visit.

Something like this would work:

(defun ace-link-org-roam ()
  "Open a visible link in an `org-roam-mode' buffer."
  (interactive)
  (require 'org-roam)
  (let ((pt (avy-with ace-link-org
               (avy-process
                (mapcar #'cdr (ace-link--org-collect))
                (avy--style-fn avy-style)))))
    (ace-link--org-roam-action pt)))
	
(defun ace-link--org-roam-action (pt)
  (when (numberp pt)
    (goto-char pt)
    (call-interactively #'org-roam-preview-visit)))

benthamite avatar Nov 12 '23 09:11 benthamite