Code Monkey home page Code Monkey logo

company-org-roam's Issues

Only offer completion when `cite:` has been entered

I'd love to use a completion feature, but only for citing. Would it be too hard to implement an option that completion only starts after typing cite:? (And, ideally, also offering only available cite completions, tht is, files with the filetag #+ROAM_KEY...)

Allow case insensitive completions

Currently the completions are case sensitive, it would be really nice to have completions that are case-agnostic.

If this becomes confusing, allowing it for just the first letter would be useful.
For example, even if I have a file titled Emacs, I should be able to see completions for emacs once I start typing em.

company-org-roam break completion of In-Buffer Settings (after #+)

After I enabled company-org-roam, completion of In-Buffer Settings ( #+DESCRIPTION, #+BEGIN_..., ...) does not work anymore.

When I remove these lines I get the suggestions again.

(use-package
  company-org-roam
  :ensure t
  :after org-roam
  :config (push 'company-org-roam company-backends))

Otherwise company-org-roam works great to insert links.

GNU Emacs 28.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-04-27

company-org-roam: 20200409.529
org: 9.3.6
org-roam: 20200504.2031

company-org-mode--init-hook doesn't seem to respect dir-local org-roam-directory

(Not sure if this is an Emacs issue or an issue with this package, so also posted at https://emacs.stackexchange.com/q/57995/17182).

I'm currently attempting to call the function company-org-roam--init-hook from org-mode-hook in order to enable the company-org-roam backend in org-roam buffers. In some of the files in which this hook is called, I've used a .dir-locals.el file to set org-roam-directory to a non-default value. However, when company-org-roam--init-hook is called while loading the file, it appears that org-roam-directory isn't set to its dir-local value, causing the hook not to enable the Company backend.

Is it expected that dir-local variables are applied only after major-mode hooks are run? If so, is there a way to work around this (besides a run-at-time)?

Interference with org agenda

With the company-org-roam package enabled, I get the following error when I try to call my org-mode agenda:

org-agenda-get-deadlines: Symbol’s value as variable is void: org-priority-highest

This started this morning. Was fine yesterday. I went through my config, turning off/on packages one at a time until it worked. When company-org-roam is not called, it works. When it is, it doesn't. Here's my config:

(use-package company-org-roam
  :straight (:host github :repo "jethrokuan/company-org-roam")
  :config
  (push 'company-org-roam company-backends))

Any ideas? Many thanks in advance!

Include alias as candidates

This is very good & useful, thank you.
It would be helpful if the completion chose alias to titles as candidates as well.

wrong-type-argument sequencep

Completion does not work at all and the following error throws.

Debugger entered--Lisp error: (wrong-type-argument sequencep \,)
  string-prefix-p(#("Pro" 0 3 (fontified t)) \, t)
  #f(compiled-function (candidate) #<bytecode 0x5337cddd>)(\,)
  -filter(#f(compiled-function (candidate) #<bytecode 0x5337cddd>) ("Entropy" "Parsing" "Text Classification" "Named-Entity Recognition" "NER" "Overfitting" "Semantic Analysis" "Probabilistic Graphical Models" "PGM" "How To Take Smart Notes With Org-mode · Jethro Kuan" "The Procrustean Bed of Productivity - Nat Eliason" "Fauxductivity: 8 Ways You Trick Yourself into Feeling Productive - Nat Eliason" "Generative Adversarial Networks" "GAN" "Shell" "Stacking" "Machine Reading Comprehension" "Sentiment Analysis" "Multiple Instance Learning" "Optimization" "Sequence Labeling" "Reinforcement Learning" "Cross Validation" "CV" "Local Outlier Factor" "High Dimensional Data" "Feature Extraction" "Metrics" "Capsule" "Logistic Regression" "t-SNE" "Clustering" "Regularization" "Tokenization" "Random Forest" "User Profiling" "Unsupervised Learning" "Feature Selection" "Machine Translation" "Algebra" "Encoding" "Kaggle" "Pre-Trained Models" "Topic Models" "GBDT" "Speech Recognition" "Anomaly Detection" "Decision Tree" "Point Networks" "Singular Value Decomposition" ...))
  company-org-roam--filter-candidates(#("Pro" 0 3 (fontified t)) ("Entropy" "Parsing" "Text Classification" "Named-Entity Recognition" "NER" "Overfitting" "Semantic Analysis" "Probabilistic Graphical Models" "PGM" "How To Take Smart Notes With Org-mode · Jethro Kuan" "The Procrustean Bed of Productivity - Nat Eliason" "Fauxductivity: 8 Ways You Trick Yourself into Feeling Productive - Nat Eliason" "Generative Adversarial Networks" "GAN" "Shell" "Stacking" "Machine Reading Comprehension" "Sentiment Analysis" "Multiple Instance Learning" "Optimization" "Sequence Labeling" "Reinforcement Learning" "Cross Validation" "CV" "Local Outlier Factor" "High Dimensional Data" "Feature Extraction" "Metrics" "Capsule" "Logistic Regression" "t-SNE" "Clustering" "Regularization" "Tokenization" "Random Forest" "User Profiling" "Unsupervised Learning" "Feature Selection" "Machine Translation" "Algebra" "Encoding" "Kaggle" "Pre-Trained Models" "Topic Models" "GBDT" "Speech Recognition" "Anomaly Detection" "Decision Tree" "Point Networks" "Singular Value Decomposition" ...))
  company-org-roam--get-candidates(#("Pro" 0 3 (fontified t)))
  company-org-roam(candidates #("Pro" 0 3 (fontified t)))
  apply(company-org-roam (candidates #("Pro" 0 3 (fontified t))))
  company-call-backend-raw(candidates #("Pro" 0 3 (fontified t)))
  company--fetch-candidates(#("Pro" 0 3 (fontified t)))
  company-calculate-candidates(#("Pro" 0 3 (fontified t)) nil)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer 20200411112850-building_a_second_brain.org> #<window 3 on 20200411112850-building_a_second_brain.org> 58 419)
  apply(company-idle-begin (#<buffer 20200411112850-building_a_second_brain.org> #<window 3 on 20200411112850-building_a_second_brain.org> 58 419))
  timer-event-handler([t 24209 30620 673561 nil company-idle-begin (#<buffer 20200411112850-building_a_second_brain.org> #<window 3 on 20200411112850-building_a_second_brain.org> 58 419) nil 0])

Error on startup

Results from emacs --debug-init

Debugger entered--Lisp error: (error "Could not find package org-roam in recipe repositories: (org-elpa melpa gnu-elpa-mirror emacsmirror-mirror)")
  signal(error ("Could not find package org-roam in recipe repositories: (org-elpa melpa gnu-elpa-mirror emacsmirror-mirror)"))
  error("Could not find package %S in recipe repositories: %S" org-roam (org-elpa melpa gnu-elpa-mirror emacsmirror-mirror))
  straight--convert-recipe(org-roam "Building company-org-roam")
  straight-use-package(org-roam nil nil "Building company-org-roam")
  straight--build-package((:host github :repo "jethrokuan/company-org-roam" :package "company-org-roam" :type git :local-repo "company-org-roam") nil)
  #f(compiled-function () #<bytecode 0x1bb0671>)()
  straight--transaction-exec(use-package-\(:host\ github\ :repo\ \"jethrokuan/company-org-roam\"\ :package\ \"company-org-roam\"\ :type\ git\ :local-repo\ \"company-org-roam\"\)-nil-nil :now #f(compiled-function () #<bytecode 0x1bb0671>))
  straight-use-package((company-org-roam :host github :repo "jethrokuan/company-org-roam"))
  eval-buffer(#<buffer  *load*-878872> nil "/home/name/.emacs.d/config.el" nil t)  ; Reading at buffer position 13934
  load-with-code-conversion("/home/name/.emacs.d/config.el" "/home/name/.emacs.d/config.el" nil nil)
  load("/home/name/.emacs.d/config.el" nil nil t)
  load-file("/home/name/.emacs.d/config.el")
  org-babel-load-file("/home/name/.emacs.d/config.org")
  eval-buffer(#<buffer  *load*> nil "/home/name/.emacs.d/init.el" nil t)  ; Reading at buffer position 1721
  load-with-code-conversion("/home/name/.emacs.d/init.el" "/home/name/.emacs.d/init.el" t t)
  load("/home/name/.emacs.d/init" t t)
  #f(compiled-function () #<bytecode 0x1e0f5d>)()
  command-line()
  normal-top-level()

Here's my init config for both org-roam and company-org-roam:

(use-package org-roam
      :hook 
      (after-init . org-roam-mode)
      :custom
      (org-roam-directory "~/Dropbox/projects/alife/")
      :bind (:map org-roam-mode-map
              (("C-c n l" . org-roam)
               ("C-c n f" . org-roam-find-file)
               ("C-c n b" . org-roam-switch-to-buffer)
               ("C-c n g" . org-roam-show-graph))
              :map org-mode-map
              (("C-c n i" . org-roam-insert))))
(setq org-roam-completion-system 'default)
(require 'org-roam-protocol)

; https://github.com/jethrokuan/company-org-roam

(use-package company-org-roam
  :straight (:host github :repo "jethrokuan/company-org-roam")
  :config
  (push 'company-org-roam company-backends))

Any thoughts? Many thanks in advance!

does not auto complete in org-journal buffer

I am using doom-emacs with minimal tweaks. company-org-roam works in org-mode buffer for me but it doesn't work in org-journal. It works fine if I invoke company-org-roam manually though, just not automatically. Any ideas?

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

It is probably related to org-roam/org-roam-server#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)))

use a different icon for org-roam

When company is returning a list of candidates the org-roam candidates are mixed with the spelling suggestions and on my theme have the same purple icon, so not sure which is the spelling and which is the reference. Would it be possible to change the return type, to maybe "Reference" which would allow the front end to decorate them differently?

Warning (bytecomp): ‘org-roam-sql’ is an obsolete function (as of org-roam 1.0.0)

I don't use straight.el, so after trying company-org-roam with use-package and the default package manager, package.el, I'm getting the following warning:

Leaving directory ‘/home/iqb/.emacs.d/elpa/company-org-roam-0.1’

Compiling file /home/iqb/.emacs.d/elpa/company-org-roam-0.1/company-org-roam.el at Tue Aug  4 10:27:52 2020
Entering directory ‘/home/iqb/.emacs.d/elpa/company-org-roam-0.1/’

Compiling no file at Tue Aug  4 10:27:52 2020
Warning (bytecomp): ‘org-roam-sql’ is an obsolete function (as of org-roam 1.0.0); use ‘org-roam-db-query’ instead.

And when typing something in a note to autocomplete:

Company: An error occurred in auto-begin
Company: backend company-org-roam error "EmacSQL had an unhandled condition: "near line 17: no such column: titles"" with args (candidates Secon)
Company: An error occurred in auto-begin
Company: backend company-org-roam error "Wrong type argument: hash-table-p, nil" with args (candidates Second)

Or running M-x company-org-roam:

helm-M-x-execute-command: Cannot complete at point

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

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

  • Emacs (GNU Emacs 27.0.90 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.61 Version 10.13.6 (Build 17G11023)) of 2020-03-11): v27.0.90
  • company-org-roam commit: 0d14bf5

Doesn't work unless I enable company-mode

After installing company-org-roam according to the installation instructions, the title-based link completion doesn't work in an org-roam buffer. I have to type "M-x company-mode", and then it works. Do the installation instructions assume that the user already has company mode enabled?

Circular completion

The article I'm on is included in the list of completions.

With the cursor at |:

#+TITLE: Yggdrasil

Ygg|

This suggests completing with the Yggdrasil article, which is the one I'm writing.

Should this function be used to filter out the curent article from the candidates?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.