mirror of
https://github.com/org-roam/org-roam
synced 2025-09-18 16:06:49 -05:00
(fix)completions: improve completion-at-point slightly (#1896)
* Allow capfs to run after org-roam-complete-everywhere. This is necessary since org-roam-complete-everywhere gets triggered on every word, even if no match has been found. * Simpler hook setup. org-roam-complete-at-point is unnecessary, better add the capfs directly.
This commit is contained in:
@@ -727,16 +727,17 @@ hence \"everywhere\"."
|
|||||||
:exit-function
|
:exit-function
|
||||||
(lambda (str _status)
|
(lambda (str _status)
|
||||||
(delete-char (- (length str)))
|
(delete-char (- (length str)))
|
||||||
(insert "[[roam:" str "]]"))))))
|
(insert "[[roam:" str "]]"))
|
||||||
|
;; Proceed with the next completion function if the returned titles
|
||||||
(defun org-roam-complete-at-point ()
|
;; do not match. This allows the default Org capfs or custom capfs
|
||||||
"Try get completion candidates at point using `org-roam-completion-functions'."
|
;; of lower priority to run.
|
||||||
(run-hook-with-args-until-success 'org-roam-completion-functions))
|
:exclusive 'no))))
|
||||||
|
|
||||||
(add-hook 'org-roam-find-file-hook #'org-roam--register-completion-functions-h)
|
(add-hook 'org-roam-find-file-hook #'org-roam--register-completion-functions-h)
|
||||||
(defun org-roam--register-completion-functions-h ()
|
(defun org-roam--register-completion-functions-h ()
|
||||||
"Setup `org-roam-completion-functions' for `completion-at-point'."
|
"Setup `org-roam-completion-functions' for `completion-at-point'."
|
||||||
(add-hook 'completion-at-point-functions #'org-roam-complete-at-point nil t))
|
(dolist (f org-roam-completion-functions)
|
||||||
|
(add-hook 'completion-at-point-functions f nil t)))
|
||||||
|
|
||||||
;;;; Editing
|
;;;; Editing
|
||||||
(defun org-roam-demote-entire-buffer ()
|
(defun org-roam-demote-entire-buffer ()
|
||||||
|
Reference in New Issue
Block a user