Another Zotero Workflow

The other day, I wrote about Michael Behr’s scientific writing workflow that is centered around Zotero, Emacs, and Org mode. Here’s another example of a Zotero workflow, this time from Nick Judd.

Like Behr, Judd collects and manages reference papers with Zotero. Unlike Behr, he prefers to write his own papers in Markdown and use Pandoc to export the result to a PDF through \(\LaTeX\) rather than use Org mode. He doesn’t explain his choice—he doesn’t even mention Org—but his workflow seems to work well for him and, of course, Markdown/Pandoc is a more universal solution than Org mode.

If Markdown makes more sense for you, be sure to take a look Judd’s post to see how he ties everything together. He has detailed directions for getting everything installed and configured. Like Behr, he uses the Emacs package Zotxt to interact with Zotero from within Emacs. And if you haven’t seen Muad Abd El Hay’s comment to my Behr post, take a look at that too. Hay describes a slightly different Zotero workflow that uses John Kitchin’s org-ref package to handle the citations. It looks like an excellent solution.

Posted in General | Tagged | Leave a comment

Running Multiple Emacs Servers

Tycho Garen has an interesting use case. Because he uses a single laptop to work on many projects, he wanted a way to have separate Emacs instances so that his buffers don’t get mixed up between projects. That’s easy enough to do by simply invoking multiple Emacs instances but then if his X-Windows dies he loses everything. As Sacha told us, the way to avoid that is to run Emacs in daemon mode. But how can you run multiple Emacs instances in daemon mode?

Garen has the answer. His solution involves having emacsclient connect to the server with TCP. Follow the link for the details. One of the commenters points out that this can be a security problem if external users can reach the socket. Stefan Monnier replied that there’s a secret key in the server file so the security problem isn’t as bad as it sounds but in any event you can still use local Unix sockets by specifying --socket-name rather than --server-file as an option to emacsclient. This is explained (sort of) in the emacsclient options section of the Emacs manual.

Garen shows another nice trick in his post. I often see people starting the Emacs daemon at boot time by messing with systemd or whatever their system uses to control the boot process. Garen simply makes use of the fact that crontab has a @reboot “time” that will perform the action when the system boots. That solves the problem nicely and easily. Again, see his post for the details.

Most of us probably won’t have occasion to need multiple Emacs instances but it’s nice to know how to do it in case the need does arise.

Posted in General | Tagged | 1 Comment

Extreme Buffers

If you tend to obsess over the number of open Emacs buffers, worrying about performance, here’s some good news

I’ve never come close to that many buffers and I don’t know what his machine configuration is like but you have to admit that that’s pretty impressive.

Posted in General | Tagged | 1 Comment

List of Emacs Configurations

When I first started using Emacs, one of the ways I learned about useful configuration settings and emacs-lisp was to read other people’s emacs configurations. Oddly, I’m still reading them today. When I read an expert’s configuration, I almost always learn something new and useful.

It’s easy to find configurations with a simple DuckDuckGo (or Google, if you must) search but caisah has curated a list of nice emacs configurations. You’ll recognize many of the people these configurations belongs to (Sacha Chua, Magnar Sveen, John Wiegley and Oleh Krehel to name just four) so you can be sure of learning some useful configuration settings and elisp tricks by reading them.

Besides the opportunity to learn some configuration items worth stealing, I find reading the configurations and seeing how other people have solved their editing problems enjoyable even if I don’t need the particular feature under discussion for my own workflow. If you feel the same way, bookmark caisah’s list and use it to check out a configuration or two when you have a few minutes.

Posted in General | Tagged | 1 Comment

Linus on XML

It’s Friday and I don’t have anything very interesting so here’s a troll instead.

Posted in General | Tagged | Leave a comment

Zamansky Live Codes Advent of Code 2016 #2

Mike Zamansky who is, after all, a teacher, demonstrates his coding technique by live coding the second exercise in the 2016 Advent of Code. He is coding in C++ because that’s what he’s teaching at the moment but even if, like me, it’s not your favorite language, it’s still a nice introduction to a certain style of coding.

That style is basically ensuring that each little piece of your code is working before you move onto to the next piece. That’s the technique that I use and love when I’m coding in Lisp. The REPL makes it really easy because you can execute a single statement and see what the result is without having to add special scaffolding. It’s a little harder in a C-like language but not, as Zamansky shows, impossible.

Note that this is a bit different from Test Driven Development. You’re merely trying to discover your errors as soon as possible rather than trying for a rigorous demonstration of correctness at each step. Since starting to program in Lisp, I use this technique no matter what language I’m using. Still, it works best in a REPL-driven language like Lisp.

Another point the video makes is the importance of data representation. By choosing a good representation you can reduce the complexity of your code and also make it easier to adjust to changes in the specifications of the problem you’re trying to solve.

The video is 17 minutes so plan accordingly.

Posted in Programming | Tagged , | Leave a comment

Literate Programming with Babel

Angelo Basile has an interesting post on using Babel and Org Mode for literate programming. As he remarks, his setup is particularly useful in an educational environment.

It’s a short post but has some useful ideas. If you’d like to try a sort of light-weight literate programming take a look at Basile’s post and try it out on a small program. Pay particular attention to the #+PROPERTY line that he puts at the top of each file. It sets up a nice default environment.

Posted in General | Tagged , | Leave a comment

Moving a File in Emacs

Sometimes you want to move a file you have open in Emacs. More often, perhaps, you simply want to rename the file. Emacs has some functions that do this but none of them are entirely satisfactory. The write-file function comes close but it leaves the old file in place and the rename functions don’t take care of the buffer. Zachary Kanfer has an interesting bit of Elisp that does the right thing.

His code copies the file to a new location (or name) using write-file so that the buffer name is changed and any changes later saved will be written to the new file. If the move is successful, the old file is deleted.

This seems pretty simple and it is but it’s surprising how often it comes up. If you find yourself in this situation more than once it’s probably worth your while to add Kanfer’s code to your init.el.

Posted in General | Tagged | 4 Comments

Scientific Writing with Zotero and Org Mode

Michael Behr has an interesting post on his scientific writing workflow. The post isn’t really about how he writes his papers but rather how he organizes and curates his research materials. As you’d expect, he uses an Org file to store links to research papers and take notes on them. If you’re an Org mode user you won’t have any difficulty imagining what this looks like.

What’s interesting about his workflow is that he use Zotero to capture and store copies of the papers he needs for his research. I used Zotero long ago when I was still using Vim and Zotero existed solely as a Firefox plugin. These days, it’s available as a standalone application as well so even if you’re not a Firefox user, you can still take advantage of it. One very nice aspect of Zotero is that it has Emacs integration so that you can interact with it from within Emacs. Behr’s post describes how this works and how he uses it.

I’m not sure how necessary Zotero is if you want a similar workflow. You can easily store the papers and link to them from within Org files without a separate application. You could, for example, use the org-attach command (see this video for an excellent introduction) to store and associate copies of the papers with an Org file. It appears that Zotero does make it a bit easier to retrieve papers but I’m pretty sure that a bit of Elisp could easily duplicate its capabilities. On the other hand, Zotero is already available and has nice integration so if you don’t mind the separate utility, it’s a good solution.

If you’re a student or researcher who needs to keep tract of papers, be sure to take a look at Behr’s post. His workflow is interesting and may give you some ideas.

Posted in General | Tagged , | 2 Comments

Zamansky 24: Org Capture (Part 2)

Mike Zamansky has another video up in his Using Emacs series. This one is a continuation of his last video on Org Mode capture. Most of the video explains how Zamansky pops up an Org capture buffer even if he’s not in Emacs. I use a similar method all the time and find it really useful. If I want to make a quick note or capture a browser link for a blog post, I just pop up the capture menu and use the appropriate template.

Zamansky’s method is better than mine because his pops up a temporary frame that is deleted when he saves the capture and leaves him back where he started. Mine switches to Emacs and displays the menu but I have to switch back to whatever I was doing after I save the capture. It’s a bit harder to pop up a capture buffer with MacOS because you have to use AppleScript. I think if I install a keyboard macro app I can duplicate Zamansky’s method so I’ll probably give that a try.

The other nice trick I learned from the video is obvious but I never thought of it. Zamansky maintains an Org file of useful browser links along with helpful commentary. He exports this to HTML and then saves the file as a browser bookmark. That way, he can click on the book mark to bring up the page of his links and then click on the appropriate link to visit the page he’s interested in. As I said, it’s obvious in retrospect but a great tip if you haven’t considered it.

Posted in General | Tagged , | Leave a comment