Code Monkey home page Code Monkey logo

company-org-roam's Introduction

Org-roam GitHub Release MELPA License GPL 3

Org-roam Logo

Org-roam is a plain-text knowledge management system. It brings some of Roam's more powerful features into the Org-mode ecosystem.

Org-roam borrows principles from the Zettelkasten method, providing a solution for non-hierarchical note-taking. It should also work as a plug-and-play solution for anyone already using Org-mode for their personal wiki.

  • Private and Secure: Edit your personal wiki completely offline, entirely in your control. Encrypt your notes with GPG. Take lasting notes in plain-text.
  • Networked Thought: Connect notes and thoughts together with ease using backlinks. Discover surprising and previously unseen connections in your notes with the built-in graph visualization.
  • Extensible and Powerful: Leverage Emacs' fantastic text-editing interface, and the mature Emacs and Org-mode ecosystem of packages.
  • Free and Open Source: Org-roam is licensed under the GNU General Public License version 3 or later.

Org-roam Screenshot

Installation

Down below you will find basic installation instructions for how to quickly install org-roam using various environments for various purposes. For more detailed information, please read the manual.

Using package.el

Toggle instructions

You can install org-roam from MELPA or MELPA Stable using package.el:

M-x package-install RET org-roam RET

Using straight.el

Toggle instructions

Installation from MELPA or MELPA Stable using straight.el:

(straight-use-package 'org-roam)

Or with use-package:

(use-package org-roam
  :straight t
  ...)

If you need to install the package directly from the source repository, instead of from MELPA, the next sample shows how to do so:

(use-package org-roam
  :straight (:host github :repo "org-roam/org-roam"
             :files (:defaults "extensions/*"))
  ...)

If you plan to use your own local fork for the development and contribution, the next sample will get you there:

(use-package org-roam
  :straight (:local-repo "/path/to/org-roam-fork"
             :files (:defaults "extensions/*")
             :build (:not compile))
  ...)

Using Doom Emacs

Toggle instructions

Doom's :lang org module comes with support for org-roam, but it's not enabled by default. To activate it pass +roam2 flag to org module in your $DOOMDIR/init.el (e.g. (org +roam2)), save the file and run doom sync -u in your shell.

To provide better stability, Doom pins the package to a specific commit. If you need to unpin it (not recommended doing that, request Doom to bump the package instead) use the next in your packages.el:

(unpin! org-roam)

If for some reasons you want to use a different recipe for org-roam, you can use the next form in your packages.el to install the package from a recipe repository (e.g. MELPA):

(package! org-roam)

You can pass :pin "commit hash" to pin the package to a specific commit.

With the next sample you can install the package directly from the source repository:

(package! org-roam
  :recipe (:host github :repo "org-roam/org-roam"
           :files (:defaults "extensions/*")))

And if you plan to use your own local fork for the development or contribution, the next sample will get you there:

(package! org-roam
  :recipe (:local-repo "/path/to/org-roam-fork"
           :files (:defaults "extensions/*")
           :build (:not compile)))

Without a package manager

Toggle instructions

To install the package without using a package manager you have the next two options:

  1. Install the package by cloning it with git from the source repository.
  2. Or install the package by downloading the latest release version.

In both of the cases you will need to ensure that you have all the required dependencies. These include:

  • dash
  • f
  • s
  • org (9.4 is the minimal required version!)
  • emacsql
  • emacsql-sqlite
  • magit-section
  • filenotify-recursive

After installing the package, you will need to properly setup load-path to the package:

(add-to-list 'load-path "/path/to/org-roam/")
(add-to-list 'load-path "/path/to-org-roam/extensions/")

After which you should be able to resolve (require 'org-roam) call without any problems.

Org-roam also comes with .texi files to integrate with Emacs' built-in Info system. Read the manual to find more details for how to install them manually.

Configuration

Here's a very basic sample for configuration of org-roam using use-package:

(use-package org-roam
  :ensure t
  :custom
  (org-roam-directory (file-truename "/path/to/org-files/"))
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n g" . org-roam-graph)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n c" . org-roam-capture)
         ;; Dailies
         ("C-c n j" . org-roam-dailies-capture-today))
  :config
  ;; If you're using a vertical completion framework, you might want a more informative completion interface
  (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
  (org-roam-db-autosync-mode)
  ;; If using org-roam-protocol
  (require 'org-roam-protocol))

Note that the file-truename function is only necessary when you use symbolic link to org-roam-directory. Org-roam won't automatically resolve symbolic link to the directory.

Getting Started

David Wilson of System Crafters has produced an introductory video that covers the basic commands:

Getting Started with Org Roam - Build a Second Brain in Emacs

Getting Help

Before creating a new topic/issue, please be mindful of our time and ensure that it has not already been addressed on GitHub or on Discourse.

  • If you are new to Emacs and have problem setting up Org-roam, please ask your question on Slack, channel #how-do-i.
  • For quick questions, please ask them on Slack, channel #troubleshooting.
  • If something is not working as it should, or if you would like to suggest a new feature, please create a new issue.
  • If you have questions about your workflow with the slip-box method, please find a relevant topic on Discourse, or create a new one.

Knowledge Bases using Org-roam

Contributing

To report bugs and suggest new feature use the issue tracker. If you have some code which you would like to be merged, then open a pull request. Please also see CONTRIBUTING.md.

License

Copyright © Jethro Kuan and contributors. Distributed under the GNU General Public License, Version 3.

company-org-roam's People

Contributors

iquabius avatar jethrokuan avatar timquelch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

company-org-roam's Issues

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!

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!

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

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...)

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])

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?

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.

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?

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?

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)?

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

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?

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-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)))

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.

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.