I am trying to do this without using company like in this thread: How to to get [[Title of the target note]] working with inline autocomplete in Org-roam
Here are my relevant configs:
minibuffer
(use-package minibuffer
:ensure nil
:demand t
:custom
(completions-detailed t)
(completions-format 'one-column)
(completion-styles '(basic partial-completion flex))
(completion-show-help nil)
(completion-category-defaults nil)
(completion-auto-help 'always)
(completion-auto-select nil)
(completion-show-inline-help nil)
(completions-max-height 6)
(completions-header-format (propertize "%s candidates:\n" 'face 'bold-italic))
(completions-highlight-face 'completions-highlight)
(minibuffer-completion-auto-choose t)
(completions-sort 'alphabetical)
(enable-recursive-minibuffers t)
:config
(minibuffer-depth-indicate-mode t)
(minibuffer-electric-default-mode t)
;; Truncate lines in the minibuffer to avoid wrapping
(add-hook 'minibuffer-setup-hook (lambda () (setq truncate-lines t))))
icomplete
(use-package icomplete
:ensure nil
:demand t
:bind ((:map icomplete-minibuffer-map
("C-n" . icomplete-forward-completions)
("C-p" . icomplete-backward-completions)
("TAB" . icomplete-force-complete)
("M-RET" . icomplete-force-complete-and-exit)
;; ("RET" . icomplete-ret)
("C-j" . exit-minibuffer)
("SPC" . self-insert-command)))
:hook ((after-init-hook . icomplete-vertical-mode))
:custom
(tab-always-indent 'complete)
(icomplete-delay-completions-threshold 0)
(icomplete-compute-delay 0)
(icomplete-show-matches-on-no-input t)
(icomplete-hide-common-prefix nil)
(icomplete-prospects-height 7)
(icomplete-separator " . ")
(icomplete-with-completion-tables t)
(icomplete-in-buffer t)
(icomplete-max-delay-chars 0)
:config
(fido-mode -1)
(setq icomplete-scroll t)
(advice-add 'completion-at-point :after #'minibuffer-hide-completions))
org-roam
(use-package org-roam
:ensure nil
:after (org org-element)
:commands (org-roam-node-find
org-roam-capture
org-roam-dailies-capture-today
org-roam-dailies-goto-today)
:bind (("C-c n f" . org-roam-node-find)
("C-c n c" . org-roam-capture)
("C-c n j" . org-roam-dailies-capture-today)
("M-`" . my-insert-date-to-icomplete-minibuffer)
:map org-mode-map
("C-c n i" . org-roam-node-insert)
("C-c n l" . org-roam-buffer-toggle)
("C-c n m" . my-org-roam-make-node)
("C-c n a" . org-roam-tag-add)
("C-c n r" . org-roam-tag-remove)
("C-c n R" . org-roam-node-random)
("C-c n g" . org-roam-graph))
:bind-keymap (("C-c n d" . org-roam-dailies-map))
:custom
(org-roam-completion-everywhere t)
(org-roam-db-extra-links-exclude-keys '((node-property "ROAM_REFS")))
(org-roam-directory (expand-file-name "~/Documents/org/roam/"))
;; REGULAR CAPTURES
(org-roam-capture-templates
;; template definitions elided
)
;; DAILIES
(org-roam-dailies-directory "journals/")
(org-roam-dailies-capture-templates
;; template definitions elided
)
:config
(require 'org-roam-dailies)
(org-roam-db-autosync-mode)
(add-to-list 'display-buffer-alist
'("\\`\\*org-roam\\*\\'"
(display-buffer-in-side-window)
(side . right)
(slot . 0)
(window-width . 0.38)
(window-parameters . ((no-delete-other-windows . t)))))
;; Collapse the backlinks buffer to its headings
(add-to-list 'org-roam-buffer-postrender-functions
#'magit-section-show-level-2-all)
(add-to-list 'org-roam-buffer-postrender-functions
#'visual-line-mode)
;; [...]
)
Here’s what happens when I am in an org-mode buffer, org-roam is active.
I type in
her<TAB>
upon hitting TAB I get an in-buffer completion pop-up. I suspect that is powered by icomplete-in-bufferoption being turned on. The completions offered there are all my org-roam nodes. So far, so good. I hit C-n and C-p to move the select-highlight from one completion candidate to another. However, once I decide on a completion, and then hit TAB, or, M-RET keys to actually select the completion, only the org-roam node’s title gets inserted into the current org mode buffer. It isn’t linkified with an org-roam id link. Saving the buffer and/or revering the buffer still doesn’t insert the org-id link.
I noticed that instead of picking a completion candidate from the in-buffer icomplete completion options, if I switch to the *Completions* buffer and pick a completion from there, then, the proper org-roam link is inserted to the buffer. However, I do not want to switch to the *Completions* buffer for this each time. I would very much like if icomplete-in-buffer could insert the org-roam nodes with id links to them.
Any suggestions?