Completion-at-point not working

Hi all,

I’ve a fresh install of org-roam, here is my config:

  (use-package org-roam
    :ensure t
    :custom
    (org-roam-directory (file-truename "~/Notebooks/org/notes/"))
    :bind (("C-c n l" . org-roam-buffer-toggle)
           ("C-c n f" . org-roam-node-find)
           ("C-c n g" . org-roam-graph)
           ("C-c n i" . org-roam-node-insert)
           ("C-c n c" . org-roam-capture)
           ;; Dailies
           ;("C-c n j" . org-roam-dailies-capture-today)
  	 )
    :config
    (setq org-roam-completion-everywhere t)
    ;; If you're using a vertical completion framework, you might want a more informative completion interface
    (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
    (org-roam-db-autosync-mode)
    ;; If using org-roam-protocol
    (require 'org-roam-protocol)
    )

The org-roam-node-find function works, and I could also use org-roam-node-insert to insert links to other nodes.

But the completion function is not working. After typing 3-4 letters, then M-x completion-at-point only gives me the following error:

ispell-lookup-words: ispell-lookup-words: No plain word-list found at systemdefault locations.  Customize ‘ispell-alternate-dictionary’ to set yours.

It seems that ispell is triggered, but not org-roam’s completion function?

My spec:

  • Manjaro linux
  • Emacs: GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.49,
  • org: version 9.7.11
  • other packages: to help debugging, I have only evil and org-roam installed atm.

Am I missing something obvious? Please help.
Thanks

Check the local value of completion-at-point-functions. I suspect evil mode loads ispell for you.

The first function in completion-at-point-functions to return a non-nil value is used by completion-at-point . The remaining functions are not called. The exception to this is when there is an :exclusive specification, as described above.

Thanks for the reply.

My completion-at-point-functions is now

(pcomplete-completions-at-point t ispell-completion-at-point)
Local in buffer algebra.org; global value is 
(tags-completion-at-point-function)

So there is indeed ispell.

I also noticed that when I create a fresh new org file inside org-roam-directory, completion works as expected, even with evil enabled.
When I edit an exiting org file inside org-roam-directory, even though this old file is completely empty, no completion-at-point.

I have also tried deleting the org-roam db file and re-building it, no effects.

Should I manually insert org-roam-complete-everywhere to completion-at-point-functions? What’s the proper way of doing it? I’ve tried:

  (with-eval-after-load 'org-roam
  (add-hook 'org-mode-hook
            (lambda ()
              (add-to-list 'completion-at-point-functions 
                           'org-roam-complete-everywhere))))

But it doesn’t seem to work.

I suggest you try this and see if completion-at-point works.

  1. Create 1 or 2 nodes. Ensure org-roam-node-find lists them.
  2. Exit Emacs, and re-launch it.
  3. Visit an org file inside org-roam-directly by using org-roam-node-find. It can be via M-x or your keybinding (do not use the normal find-file. According to your configuration, find-file won’t load org-roam – I hope you are conscious about this choice).
  4. While inside the org file, check the value of completion-at-point-functions again

At point 4, you should see org-roam-complete-everywhere org-roam-complete-link-at-point in the beginning of the value.

If this is not the case, I suspect your configuration is not good.

Ensure:

  • The correct value in the completion-at-point-functions as above,
  • The value of org-roam-completion-everywhere is t
  • Some nodes exist in org-roam-directory
  • org-roam-node-find lists them

Then M-x completion-at-point` should work.

I see. So I need to somewhere “activate” org-roam for the completion to be “registered”, e.g. by using org-roam-node-find first.
Could I force an “activate” of org-roam, rather than letting it lazily load?

Yes.

Put this somewhere outside the lazy-loading part.

That worked! Many thanks

1 Like