RSS Atom Add a new post titled:
Install zotxt-emacs

Intro

I am using Zotero already with LibreOffice Writer and Microsoft Word, but at this moment I need to do focused structured work and for this I like Emacs Org Mode best. Finally I am sufficently motiviated to Google "Emacs" and "Zotero" together and voilà, I get inmediate advice from Michael Behr - the article is great and got me starting quick, once it was set up. And this is done like this:

  1. Install the Zotero plugin zotxt
  2. Install the zotxt-emacs package from MELPA

You're done.

Fail! Number 1. went well, but number 2. gave me headaches, because, because ... I'll tell that later, maybe it's useful for someone, but I'd better explain first how I got it working.

How

Note: This article refers to a plain Debian stretch installation with Emacs 25.1.1. with only the basic emacs25 package installed.

Local Emacs library directory

¿You already have a local emacs library directory? If not here is how I set this up - and with roaming!

My Nextcloud folder contains an emacs subdirectory: ~/Nextcloud/emacs

In .emacs I have the following lines:

(let ((default-directory  "~/Nextcloud/emacs/"))
  (normal-top-level-add-subdirs-to-load-path))

This tells Emacs that any subdirectory of ~/Nextcloud/emacs contains a library (with some constraints on the directory names).

zotxt-emacs and dependent packages

Now get all the needed emacs libraries and put them in your local Emacs library directory.

cd ~/Nextcloud/emacs
git clone https://github.com/egh/zotxt-emacs.git
git clone https://github.com/tkf/emacs-request.git
git clone https://github.com/kiwanami/emacs-deferred.git

Finish up

That's all folks. Start emacs, load-library org-zotxt, go back to Michael Behrs article and get rolling with citation in Org mode.

If you want to enable org-zotxt-mode automatically in any .org buffer put the following into your .emacs:

(require 'org-zotxt)
(add-hook 'org-mode-hook 'org-zotxt-mode)

Hiccups

Emacs package manage

Michaels instructions let me believe, that with my modern emacs25 I can just M-x package-install RET zotxt RET, since the package manager is included and configured. I have never used this beast, so I just try and it doesn't find the package. I try to refresh the package list, but it does not appear. I follow the Michals link to the instructions on the Emacs Wiki for setting up to see, if there is something to refreshing that I need to now. Finally I go back to good old Google and find out, that zotxt-emacs is hosted on the MELPA archive. Emacs only comes preconfigured with GNU ELPA.

MELPA

I'm bad at reading elisp code, so I skip visually through the set up instructions until I find the URL for MELPA and add it to Emacs package archive list, then I refresh the package list and get ... nothing.

Google tells me to toggle 'debug on error' on and I find out, that the MELPA archive get's skipped. It is, because it cannot read https.

I will come back to https later. In the end, MELPA also has a plain http URL and I can install the zotxt-emacs package, but it does not load. It requires - and fails to load - a package emacs24.4.

Somewhat confused I install emacs24, and with this try to install package zotxt-emacs. It requires - and fails to load - a package emacs24.4. Oh! My emacs24 is Emacs 24.5. Boy, I am in dependency hell!

This enlightens me.

The zotxt-emacs README tells me, that it requires "GNU emacs >= 24.3, or any version of emacs 25", so I should be set with what I have. Why not download two or three elisp files and install them locally?

That worked out, but let's have quick look at https support in Emacs.

Emacs gnutls

Quick googling shows some hints, that some versions of gnutls do not work with some version of Emacs GnuTLS. While installing emacs24 I see that gnutls-bin is installed as a dependency. Was this missing from the emacs25 installation? I only had libgnutls installed before. Let's check again.

I put in the https ELPA URL and ... nothing: the repository get's skipped.

I google and load-library gnutls, everything find. I run gnutls-available-p, at least I intent to, because it is not defined. So: if the library gets loaded but cannot work with the current version of GnuTLS` I'd expect it to tell me that. I expect the library to implement the function it announces on the official webpage. If it does not get loaded I expect Emacs to tell me so.

Whatever! At this moment in time and space it seems, that neither emacs24 nor emacs25 can work together with GnuTLS in order to download packages via https. I hope that either I did something stupidly wrong or that it will be fixed soon.

Moral of the story

For complex and dinamically evolving applications don't use your distros packages, install and maintain them directly from the source.

I knew that already, but...

Posted