org-roam / company-org-roam

Company completion backend for Org-roam
GNU General Public License v3.0
57 stars 4 forks source link

post-completion throws an error when buffer has no corresponding file. #2

Closed chrischambers closed 4 years ago

chrischambers commented 4 years ago

Description

company-org-roam--post-completion throws an error if the buffer has no corresponding file.

Steps to Reproduce

  1. Load Emacs w/ org-roam and company-org-roam, and at least a couple of existing backlinks in the database.
  2. Ensure company-org-roam is active and that a buffer with no corresponding file is active (e.g. the scratch buffer).
  3. Complete one of the org-roam backlinks.

Expected Results

Completion should occur without error.

Actual Results

E.g. completing on 'Computer Science Terminology':

  file-truename(nil)
  company-org-roam--post-completion("Computer Science Terminology")
  company-org-roam(post-completion "Computer Science Terminology")
  apply(company-org-roam post-completion "Computer Science Terminology")
  company--multi-backend-adapter((company-org-roam :with company-yasnippet) post-completion "Computer Science Terminology")
  apply(company--multi-backend-adapter (company-org-roam :with company-yasnippet) (post-completion "Computer Science Terminology"))
  company-call-backend-raw(post-completion "Computer Science Terminology")
  apply(company-call-backend-raw (post-completion "Computer Science Terminology"))
  company--force-sync(company-call-backend-raw (post-completion "Computer Science Terminology") (company-org-roam :with company-yasnippet))
  company-call-backend(post-completion "Computer Science Terminology")
  company-cancel("Computer Science Terminology")
  company-finish("Computer Science Terminology")
  company-complete-selection()
  funcall-interactively(company-complete-selection)
  call-interactively(company-complete-selection nil nil)
  command-execute(company-complete-selection)

Versions

jethrokuan commented 4 years ago

There are two options here:

  1. Turn off completions if the buffer has no corresponding file (otherwise no relative path can be formed)
  2. Insert an absolute path instead

which would you prefer?

chrischambers commented 4 years ago

My preference would be option 2 - the absolute path. Thanks for the prompt response!