xenodium/company-org-block

Can't automatically trigger completion

arozbiz opened this issue · 11 comments

Great package, but I'm having trouble automatically triggering completion. I've set it up using the use-package instructions you provided, but nothing pops up when I insert <. But completion does pop up when I run company-org-block.

From the org mode buffer, what's the outpout of M-x eval-expression RET company-backends RET?

roryk commented

Thanks @xenodium! I have the same issue-- also there aren't very many options for company completion even if I manually run it with company-org-block, how do you have your company configured to have so many completion options?

(company-capf (:separate company-dabbrev company-yasnippet company-ispell))

From the org mode buffer, what's the outpout of M-x eval-expression RET company-backends RET?

(company-org-block)

also there aren't very many options for company completion even if I manually run it with company-org-block, how do you have your company configured to have so many completion options?

@roryk Listed languages are based on your babel configuration (ie. org-babel-load-languages). My entire org config is at https://github.com/xenodium/dotsies/blob/main/emacs/features/fe-org.el

(company-capf (:separate company-dabbrev company-yasnippet company-ispell))

company-org-block isn't in backends. See https://github.com/xenodium/company-org-block#install

(company-org-block)

@arozbiz could you check if changing company-minimum-prefix-length to 1 helps?

roryk commented

@xenodium Thanks so much for answering my question!

(company-org-block)

@arozbiz could you check if changing company-minimum-prefix-length to 1 helps?

Unfortunately it does not. I've confirmed that company generally works with single-character prefixes. But company-org-block completion still doesn't automatically start.

hmmm... hard to tell without more info... anything interesting in the *Messages* buffer? What's your company configuration?

Do you hit breakpoints if you C-u C-M-x the company-org-block function (and press < from org buffer).

Edit: formatting

When I enable edebug on company-org-block I hit a breakpoint when explicitly calling the function, but not when simply pressing <. Nothing in *messages*.

Here's the relevant company-related stuff from my init.el:

(use-package company
  :defer 2
  :diminish
  :custom
  (company-begin-commands '(self-insert-command))
  (company-idle-delay .4)
  (company-minimum-prefix-length 1)
  (company-show-numbers t)
  (company-tooltip-align-annotations 't)
  (global-company-mode t))

(use-package company-box
  :after company
  :diminish
  :hook (company-mode . company-box-mode))

(use-package company-org-block
  :custom
  (company-org-block-edit-style 'auto) ;; 'auto, 'prompt, or 'inline
  :hook ((org-mode . (lambda ()
                       (setq-local company-backends '(company-org-block))
                       (company-mode +1)))))

Check out company's company-begin-commands documentation. The default value has a couple of org-related items (ie. org-self-insert-command and orgtbl-self-insert-command).

Overriding company-begin-commands got rid of them:

:custom
  (company-begin-commands '(self-insert-command))

Restoring org-self-insert-command at a minimum made it work for me. Could you try the following?

:custom
  (company-begin-commands '(self-insert-command org-self-insert-command))

edit: additional snippet.

That worked! Many thanks for all the help.