Org-roam-bibtex refuses to install with org-roam 2.2

Hi,

this is my setup:

  • Emacs: GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
    of 2021-03-27, modified by Debian
  • Framework: N/A
  • Org: Org mode version 9.4 (9.4-dist @ /usr/share/emacs/site-lisp/elpa/org-9.4/)
  • Org-roam: 2.2.0

I have an almost complete working setup thanks to Lucid Manager excellent guide. I even have org-roam-ui installed and working (BTW, it simply rocks!!).

One thing I am struggling with is org-roam-bibtex. If I M-x package installorg-roam-bibtex, I end up with a message Package 'emacs-27.2' is unavailable. I think this is suggesting that the org-roam-bibtex cannot install as it needs Emacs 27.2 an I’m running 27.1 (Debian 11 Stable).

I want to avoid installing Emacs 27.2 from testing/unstable if I can (I want an ultra stable machine and never rely on testing/unstable). Am I doomed or is there a way around this (i.e. maybe installing previous version on org-roam-bibtex)?

Thanks

I’d let its author @mshevchuk speak for the package. But just one thing. Would you permit yourself compiling Emacs from source? If so, you could take the appropriate version branch and build your own.

Well, interesting proposition but the learning curve for Emacs+Org is steep and don’t’ want to get distracted. Let’s see if someone else like @mshevchuk has an easier way out.

Hi @gigatux, I can’t remember why exactly ORB requires Emacs 27.2. I believe the only reason is that Emacs 27.2 is the current official stable Emacs release and I unfortunately can’t afford to support outdated software. Anyway, I’ll look through the code and may eventually lower this requirement to Emacs 27.1 but not lower. As far as I remember, there were issues with Emacs 26.3 because of the Org version shipped with that Emacs release.

In any case, you can always install ORB manually. Download the files from the git repo and add the directory to load-path, if you don’t use `use-package:

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

The REAMDE file also contains instructions for a manual installation for use-package users.

As someone who has been using Debian as a desktop operating system for several years and who’s currently maintaining a couple of small private Debian servers, may I ask you about the reasons of using Debian Stable on a desktop machine? I assume you are not installing ORB on a server.

:+1:

I’ve finally switched to Emacs 28.0.90 and must say it rocks! I’ve made several attempts over the past one and a half year but the native compilation feature hasn’t been ripe enough all this time. Now it’s pretty solid. No issues at all. I hope the official Emacs 28.1 release will not take too long.

1 Like

Cheers @mshevchuk . I use Debian Stable on desktop (Debian user since 1998) because I’ve use testing/unstable for many years and went through data losses. Can’t bare the pain. Prefer stable outdated software rather than being on the edge all the time.

I have the following in the init.el … I don’t think it works though as when i try to initiate with M-x org-roam-bibtex-mode it’s not coming up in the available choices in Emacs (actually is empty).

(use-package org-roam-bibtex
  :after (org-roam helm-bibtex)
  :load-path "~/.emacs.d/projects/org-roam-bibtex" ; Modify with your own path where you cloned the repository
  :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
  :config
  (require 'org-ref))

BTW, I downloaded from git as per the installation manual here but wouldn’t this be the same file as M-x package install?

Hi @gigatux!

Oops I knew this was a silly question :joy:

Not really. If you install a package with M-x package-install then 1) you don’t actually need the :load-path section at all because the Emacs package manager package.el takes care of that and 2) since package-install failed in your case, ORB was not installed and there is no such a directory ~/.emacs.d/projects/org-roam-bibtex, and therefore this statement is also useless.

If you install a package manually, without package.el, then you should specify the load path of your package. If you use use-package, then the :load-path section is what you need. Without use-package you should have a statement (add-to-list 'load-path ...) in your init.el or an equivalent one.

@mshevchuk, I think I have it working now with the following:

(add-to-list 'load-path "~/.emacs.d/projects/org-roam-bibtex/")
  :config
  (require 'org-ref)
  (require 'org-roam-bibtex)
  (org-roam-bibtex-mode)

If there are any quick wins you think I should have in my basic config, please let me know. I guess the next step is really digesting the manual.

There is so much to get my head around but its a start. I think the power of org-roam-bibtex lies when coupled with org-ref. I still have to work out which package does what to harness the full power of these packages.

For now, I have managed to insert citations with the org-ref configuration below which I nicked from here.

(use-package org-ref
    :config
    (require 'org-ref-helm)
    (setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body
          org-ref-insert-cite-function 'org-ref-cite-insert-helm
          org-ref-insert-label-function 'org-ref-insert-label-link
          org-ref-insert-ref-function 'org-ref-insert-ref-link
          org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body)))
    (setq org-latex-pdf-process
          '("pdflatex -interaction nonstopmode -output-directory %o %f"
            "bibtex %b"
            "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
            "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
    :bind (:map org-mode-map
                ("C-c ]" . org-ref-insert-link)
                ("s-[" . org-ref-insert-link-hydra/body)))

@gigatux great that you’ve figured it out.

ORB is currently a beta quality software and a proper manual is what it is lacking to reach v1.0. So if you have any questions, don’t hesitate to ask them here.

By the way, this is not the first time when I say one should be cautious when using Internet blogs to pick up some configuration snippets. Although the above Org-ref snippet is “grammatically” fine and won’t break your Emacs session, and will in practice do what you want from it, it is still conceptually inconsistent. There is absolutely no reason to put (setq org-latex-pdf-process ... in the :config section of (use-package org-ref ...). You are configuring org-ref while org-latex-pdf-process belongs to a completely different package. Why would you set this variable here and not in its own block when it is not even connected to Org-ref by some sort of interdependency? It would be reasonable perhaps to do as you do it if the (setq orb-latex-pdf-process ...) form were evaluating some Org-ref-specific code but even in that case there would be several other cleaner ways to achieve what you want. What I want to say here is that building up your own config is a process of asking the same questions all over again: 1) what does this particular piece of code do? 2) what does this particular piece of code do here? Otherwise one quickly gets lost and frustrated by the amount of time needed to understand and debug a personal Emacs config. The edge-case scenario for the above snippet is that if the package Org-ref is not loaded for some reason, then its :config section is not evaluated and org-latex-pdf-process is not set to the desired value and you won’t be able to use it the way you intend it to until Org-ref is loaded. Such minor nuances can sometimes be very nasty especially when you have dozens of packages which you try to make play nice together.

This looks a little bit unusual. Are these the top-level forms or just excerpts from a (use-package ...) statement?

If these are top-level forms, then they are OK except that the :config keyword is unnecessary here. It does absolutely nothing being simply a constant.

If you use use-package but need to install ORB manually and not with package.el, then the most canonical way would be as follows:

(use-package org-roam-bibtex
  :defer t
  :load-path "~/.emacs.d/projects/org-roam-bibtex/"
  :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
  :config
  (require 'org-ref))

Then you have at least two ways to automatically initialize the package:

  1. put (org-roam-bibtex-mode +1) outside the (use-package org-roam-bibtex ...) block.
  2. put this call in the config section of (use-package org-roam ...):
(use-package org-roam
  ....
  :config
  ...
  (org-roam-bibtex-mode +1)
  ...)

The second one is preferable because (org-roam-bibtex-mode +1) will be evaluated, and respectively the package Org-roam-bibtex will be loaded only after Org-roam has been loaded. In turn, by properly configuring Org-roam you can defer loading these packages until you actually need them. The first one is OK though if you do want org-roam-bibtex-mode running immediately after starting your Emacs session.

@gigatux In the latest commit to ORB, the minimal required version of Emacs was lowered to v27.1. You should now be able to install the package with M-x package-install. If it doesn’t install then wait a couple of hours until the changes propagate to MELPA. You’ll be able to configure the package as follows (without the :load-path block):

(use-package org-roam-bibtex
  :defer t
  :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
  :config
  (require 'org-ref))

Excellent! Thanks