org-roam / company-org-roam

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

company-org-roam stopped working after recent org-roam update #21

Closed msarvar closed 4 years ago

msarvar commented 4 years ago

It is probably related to https://github.com/org-roam/org-roam-server/issues/53 I was able to fix it locally by updating company-org-roam--update-cache () From:

(defun company-org-roam--update-cache ()
  "Update the cache with new entries.
Entries with no title do not appear in the completions."
  (let ((dir (file-truename org-roam-directory))
        (ht (make-hash-table :test #'equal)))
    (dolist (row (org-roam-db-query [:select [titles file] :from titles]))
      (let ((titles (car row))
            (file (cadr row)))
        (dolist (title titles)
          (puthash title file ht))))
    (puthash dir ht company-org-roam-cache)))

To:

(defun company-org-roam--update-cache ()
  "Update the cache with new entries.
Entries with no title do not appear in the completions."
  (let ((dir (file-truename org-roam-directory))
        (ht (make-hash-table :test #'equal)))
    (dolist (row (org-roam-db-query [:select [title file] :from titles]))
      (let ((title (car row))
            (file (cadr row)))
          (puthash title file ht)))
    (puthash dir ht company-org-roam-cache)))