# Only enable company mode for node title completions

**URL:** <https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797>\
**Category:** Troubleshooting\
**Created:** [April 21, 2025, 2:25pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797 "2025-04-21T14:25:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![orgroamer](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@orgroamer](https://org-roam.discourse.group/u/orgroamer)\
**Post date:** [April 21, 2025, 2:25pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/1 "2025-04-21T14:25:22Z")

</div>

I’d like to only enable company mode for node completions when I type `[[` or run `completion-at-point`. Recently I got this working, but it’s trying to autocomplete whenever I type anything in Org buffers, which is very distracting. Feels like this should be simple to achieve, but I can’t think of a way of doing it OTOH.  
(I’d like company mode to do completion as normal everywhere else, it’s only in Org buffers I don’t want it for anything except node title completions.)

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [April 21, 2025, 2:54pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/2 "2025-04-21T14:54:20Z")

</div>

I suggest to first check user option `org-roam-complete-everywhere`. It’s probably non-nil for you.

---

<div class="post-metadata">

**Author:** ![orgroamer](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@orgroamer](https://org-roam.discourse.group/u/orgroamer)\
**Post date:** [April 21, 2025, 4:22pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/3 "2025-04-21T16:22:24Z")

</div>

I just set it to nil, but the same thing still occurs.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [April 21, 2025, 4:33pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/4 "2025-04-21T16:33:13Z")

</div>

Then I am afraid I have no idea. My guess is something outside Org-roam is interfering in your Emacs. I’d have a look at user option `org-roam-completion-functions` and see what functions are set there, and edebug them to see what’s happening in the runtime.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [April 21, 2025, 4:34pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/5 "2025-04-21T16:34:42Z")

</div>

Just in case, you may have abbrev completion happening for your company, which has nothing to do with Org-roam…

---

<div class="post-metadata">

**Author:** ![orgroamer](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@orgroamer](https://org-roam.discourse.group/u/orgroamer)\
**Post date:** [April 21, 2025, 6:24pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/6 "2025-04-21T18:24:42Z")

</div>

It turns out I had `org-roam-complete-everywhere` in my `org-roam-completion-functions`, I had only set `org-roam-completion-everywhere` to nil before. What is the difference between these 2 things?

Tried removing `org-roam-complete-everywhere` from `org-roam-completion-functions` but it’s still staying there for some reason.

I have `company-dabbrev` in my `company-backends` but not `company-abbrev`, which is I think what you are referring to.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [April 22, 2025, 10:18am UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/7 "2025-04-22T10:18:28Z")

</div>

> [@orgroamer](#):
>
> It turns out I had `org-roam-complete-everywhere` in my `org-roam-completion-functions`, I had only set `org-roam-completion-everywhere` to nil before. What is the difference between these 2 things?
> 
> Tried removing `org-roam-complete-everywhere` from `org-roam-completion-functions` but it’s still staying there for some reason.

These are two different things; they happen to have the same name. One is a function and the other is a customizing variable. The docstring of the function `org-roam-complete-everywhere` clarifies how they work together:

```auto
Complete symbol at point as a link completion to an Org-roam node.
This is a ‘completion-at-point’ function, and is active when
‘org-roam-completion-everywhere’ is non-nil.

```

In order to solve your problem, I suggest you read Company’s documentation a bit more. I don’t use Company but I think your configuration of `company-backends` needs adjustment. And I suspect having `company-dabbrev` or `company-dabbrev-code` in `company-backends` causes this “aggressive” completion in your Org mode buffers.

You should be able to test the idea by doing something like this from [this part of the manual](https://company-mode.github.io/manual/Backends.html#Package-Backends).

```auto
(setq company-backends '((company-capf company-dabbrev-code)))

```

Or even

```auto
(setq company-backends '((company-capf)))

```

Org-roam’s completion uses a `completion-at-point` function (typically abbreviated as “capf”, **c** ompletion **a** t **p** oint **f** unction), as noted in the docstring of `org-roam-complete-everywhere` quoted above.

Once you know what `company-backends` set up works for your Org buffers with Org-roam, then it will be simply a matter of setting it **locally** for Org buffers via `org-mode-hook` so as not to affect other major modes.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![orgroamer](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@orgroamer](https://org-roam.discourse.group/u/orgroamer)\
**Post date:** [April 22, 2025, 6:04pm UTC](https://org-roam.discourse.group/t/only-enable-company-mode-for-node-title-completions/3797/8 "2025-04-22T18:04:28Z")

</div>

Thank you, `(setq-local company-backends '((company-capf)))` upon `org-mode-hook` completely solves my problem. I will look at the other things you’ve sent too.
