mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): fix [[*]] completion (#1166)
Links now complete to [[roam:*foo]] rather than the incorrect [[*roam:foo]]
This commit is contained in:
@ -263,7 +263,7 @@ DESC is the link description."
|
|||||||
"Do appropriate completion for the link at point."
|
"Do appropriate completion for the link at point."
|
||||||
(let ((end (point))
|
(let ((end (point))
|
||||||
(start (point))
|
(start (point))
|
||||||
collection link-type)
|
collection link-type headline-only-p)
|
||||||
(when (org-in-regexp org-link-bracket-re 1)
|
(when (org-in-regexp org-link-bracket-re 1)
|
||||||
(setq start (match-beginning 1)
|
(setq start (match-beginning 1)
|
||||||
end (match-end 1))
|
end (match-end 1))
|
||||||
@ -285,7 +285,8 @@ DESC is the link description."
|
|||||||
(setq collection #'org-roam-link--get-titles))
|
(setq collection #'org-roam-link--get-titles))
|
||||||
('headline
|
('headline
|
||||||
(setq collection #'org-roam-link--get-headlines)
|
(setq collection #'org-roam-link--get-headlines)
|
||||||
(setq start (+ start star-idx 1))))))))))
|
(setq start (+ start star-idx 1))
|
||||||
|
(setq headline-only-p t)))))))))
|
||||||
(when collection
|
(when collection
|
||||||
(let ((prefix (buffer-substring-no-properties start end)))
|
(let ((prefix (buffer-substring-no-properties start end)))
|
||||||
(list start end
|
(list start end
|
||||||
@ -299,8 +300,11 @@ DESC is the link description."
|
|||||||
collection)
|
collection)
|
||||||
:exit-function
|
:exit-function
|
||||||
(lambda (str &rest _)
|
(lambda (str &rest _)
|
||||||
(delete-char (- (length str)))
|
(delete-char (- 0 (length str)
|
||||||
(insert (concat (unless (string= link-type "roam") "roam:") str))))))))
|
(if headline-only-p 1 0)))
|
||||||
|
(insert (concat (unless (string= link-type "roam") "roam:")
|
||||||
|
(when headline-only-p "*")
|
||||||
|
str))))))))
|
||||||
|
|
||||||
(provide 'org-roam-link)
|
(provide 'org-roam-link)
|
||||||
;;; org-roam-link.el ends here
|
;;; org-roam-link.el ends here
|
||||||
|
Reference in New Issue
Block a user