Storing Secrets

In my never ending crusade to move as many functions as possible into Emacs, I’ve lately been dealing with functions that require a user name and password. For example, part of the mbsync configuration that downloads my emails requires a user name and password. Similarly, org2blog/wp needs the password for my blog.

Here at Irreal, we’ve settled on two strategies:

  • Putting the credentials in the .authinfo file
    This method has the benefit that you can get at the credentials with Elisp. This makes it easy to make passwords and other credentials available to your Emacs configuration without having them displayed in plain text. Take a look at the auth-source info documentation and auth-source.el to see what’s available. Sadly not all the functions are documented so you may have to look at the code. See the Blogging section of Arjen Wiersma’s configuration for an example of using the auth-source package with org2blog/wp.
  • Putting credentials in the macOS keychain
    Obviously, this is Mac specific but the other OS’s have similar functionality. This method is useful when you need to get at the credentials from outside Emacs. For example, my mbsync configuration retrieves the password for the Apple IMAP server from the Mac keychain because Elisp isn’t available to mbsync. Aria Fallah has an excellent post on how to access the Mac keychain. If you’re running on macOS, you need to give it a read.

Lately, I’ve been working on bringing Gmail under the mu4e umbrella. Gmail really wants you to use OAuth2 to authenticate and they make it pretty easy to set up an account to get the tokens but it’s really hard to see how to integrate it into mbsync. There’s some python code on the Web that I think I can have mbsync call to do the OAuth2 but as far as I can tell, most mbsync users simply turn off the OAuth2 authentication to get things working.

That’s not ideal but isn’t a worry for me because I use Gmail only for mailing lists. Still, it would be nice to find a reasonable solution using OAuth2.

Posted in General | Tagged , , | 4 Comments

Arjen Wiersma’s Emacs Configuration

I was trolling through the Emacs tweets when I saw one entitled “Emacs 25.2 Released” with a link to a video. I thought it was going to be a discussion of the new things in Emacs 25.21 but it turned out to be a video by Arjen Wiersma about his Emacs 25.1 configuration.

You might think I was disappointed by the bait-and-switch2 but I wasn’t. Wiersma steps through many of the most important packages he uses and demonstrates how they work. Although his configuration—with the exception of the Clojure stuff—is pretty much like mine, I did learn a couple of new things. For instance, there is a counsel-imenu command that brings the convenience of swiper to imenu. Similarly, there is a counsel-unicode-char command that makes it really easy to enter Unicode characters if you can come close to their name. I’ve installed both (or, really, just bound key sequences to them) and have already found them useful.

There are lots of other goodies in his configuration, which you can browse here. If you’re looking for a good developer’s configuration, this is an excellent place to start. Wiersma is mostly concerned with Clojure but his setup will work well for any developer. I really recommend that you take a look at it.

Footnotes:

1

Even though 25.2 is mostly a bug-fix release, there are a few new things as described in the NEWS file.

2

Wiersma wasn’t the tweeter so he’s not responsible for the bad title on the tweet.

Posted in General | Tagged | 1 Comment

Blogs and Journals in Science

Blog readers—and since you’re reading this, that includes you—appear to having been doing something right. At least according to Daniel Lakens, an experimental psychologist who publishes the blog The 20% Statistician. In an interesting post, Lakens argues that blogs have higher scientific quality than journals.

That’s a startling claim, especially for those of us trained in the sciences where journals are considered the gold standard for transmitting scientific knowledge. Lakens offers 5 reasons for his assessment1. The first is basically that blogs more closely approximate the ideal of reproducible research whereas Journals are just beginning to embrace the idea.

He also notes that blogs have better error correction. Generally, if an error is discovered in a blog, the poster will correct the error and note the update in the original posting. Journals can’t do that of course even if they are committed to issuing corrections. Almost always the correction gets lost and unseen by readers.

His other reasons boil down to “gatekeeper” issues. Most journals are hesitant (or refuse) to publish articles that go against the common wisdom—the debate on climate change illustrates this nicely: whatever your position on it, there’s no denying that deniers have a hard time getting published.

Anyone can publish a blog so you avoid issues of eminent researchers being given preference and other biases of editors and reviewers. Everything is, in short, out in the open for the reader to judge. Peer review is a useful device—or at least it seems like it should be—for vetting articles so that readers can presume a measure of accuracy in journal articles but the shockingly high irreproducibility of the results in many journal articles casts doubt that it’s actually working as intended.

Lakens’ post is a provocative and interesting read; it’s well worth a few minutes of your time if you’re involved in scientific publishing or just like contrarian views.

Footnotes:

1

Lakens says up front that he’s mostly familiar with journals in Psychology but his arguments seem generally applicable.

Posted in Blogging | Tagged | 3 Comments

Ogbe’s Literate Emacs Configuration

Dennis Ogbe is an EE PhD student at Purdue whom I’ve written about before (1, 2, 3). He’s very good at leveraging Emacs and Org mode in his workflow, both in his studies and his blog. Recently, I saw this tweet:

that pointed to Ogbe’s Emacs configuration. It’s written in Literate form with Org mode and has a ton of good ideas in it. Some of his choices probably aren’t the ones you’d make but if you’re looking for a good go-by for a configuration aimed at someone in the scientific/technical fields, this is an excellent choice. He’s documented everything so you can tell why he made the choices he did.

Even if you’re not looking for a new Emacs configuration, it’s worth taking a look at his just for the ideas. You might find a couple of things to add to your own setup.

Posted in General | Tagged , | Leave a comment

SBCL 1.3.17

I’ve been a little lax about keeping SBCL up to date but when I saw the announcement for SBCL 1.3.17, I downloaded, compiled, and installed it before I forgot. You can get your copy here. I always build from source but there are also binaries (for some systems) available.

I’m happy to report that it builds without problems on my Macs and passes the regression tests with no unexpected failures. As I say with every release, if you’re looking for a really good Common Lisp environment, look no further. SBCL produces excellent native code, is completely open source, and is under constant development and improvement.

Posted in General | Tagged , | Leave a comment

Zamansky 33: Projectile and Dumb Jump

Mike Zamansky has video number 33 up in his Using Emacs series. This video discusses Projectile and dumb-jump. As most of you probably know, Projectile is Bozhidar Batsov’s project interaction package for Emacs. It provides handy features for using Emacs at the project level. I’ve always thought of it as a tool for developers working with large projects who need a way of navigating around the project files easily. Zamansky’s video shows that it’s also appropriate for people who have a number of groups of related files that they wish to deal with as a whole even if they aren’t really projects. Even if you aren’t dealing, strictly speaking, with “projects,” you may find it handy so you should take a look at the video to see if it will work for you.

The other package that Zamansky discusses is dumb-jump. It performs the same basic function has the various TAGS systems but without having to generate or maintain a TAGS file. It’s a bit slower because it uses The Silver Searcher, ripgrep, or grep to locate the desired targets. From Zamansky’s video, it appears to work pretty quickly with The Silver Server.

I’m pretty impressed with the idea of dumb-jump and will probably give it a try. Early on in my career I developed a dislike for TAGS systems because it was such a pain to maintain the TAGS files. That’s probably easier now but my prejudice prevails. Dumb-jump seems like a nice compromise. It supports all the languages that I use regularly and there’s virtually no configuration after you include the use-package in your init.el.

The video is just short of 11 and a half minutes so you should easily be able to find time to watch it. If you aren’t familiar with Projectile and dumb-jump, it’s definitely worth your while.

Posted in General | Tagged | Leave a comment

The Value of Source Code in Emacs

Arun Isaac makes a nice point. Most of us support open source and insist on our right to have source code available but we hardly ever look at that source. Except for Emacs. Isaac observes that when the documentation is missing or ambiguous, he simply follows the link to the source to see what’s really going on.

Of course, you have to know some Elisp but the point is that the source is instantly available without leaving Emacs. You can check it and then return to your original buffer with your new knowledge. It’s life changing in a way that even the best of most open source software is not.

As I’ve said before, it’s because Emacs (sort of) recapitulates the Lisp Machines of yore. There are no secrets and everything is available in your chosen environment. This, more than anything, is why I am moving as much as possible into Emacs.

Posted in General | Tagged | 1 Comment

Installed Emacs 25.2

Emacs 25.2 is mostly a bug-fix release and I haven’t had any problems so I didn’t bother installing it as soon as it was released. Still, Irreal likes to be up-to-date on all things Emacs so I finally got around to compiling and installing it. Really, compiling it from source isn’t much harder than using homebrew or one of its siblings.

Here’s the recipe for compiling and installing it on macOS:

cd path-to-untared-source
configure --with-ns CFLAGS="-g3 -O2 -I /usr/local/include/libxml2"
make
make install
sudo mv nextstep/Emacs.app /Applications

I always mv my current Emacs to a backup version but that’s probably just irrational paranoia. The above recipe builds Emacs with EWW support. If you have additional needs, you may have to adjust the configure.

UPDATE [2017-04-27 Thu]: John Mastro commented that he thought specifying the CFLAGS variable to configure overroad the default value, which turns on some optimization. After some investigation, which you can read about in the comments, I discovered that that was indeed the case. I rebuilt Emacs with the new configure invocation shown above. If you followed the old recipe, you may want to do the same.

Posted in General | Tagged | 9 Comments

Irreal Is 6

Today Irreal, in its current incarnation, is six years old. For the last 5 years I’ve posted pretty much everyday.

In its original incarnation as a Blogger blog, I had in mind that Irreal would be mostly about Scheme and Lisp and would feature answers to the exercises in SICP. Things turned out differently, of course, and now I write mostly about Emacs, Security, and government surveillance on its citizens.

Six years (or 8 if you count the original Irreal) seems like a long time but then I look at people like Sacha Chua who’s been blogging so long it seems as if she must have started when she was her daughter’s age. So as much as the idea of retiring and living off the generous Irreal International Pension Fund sometimes seems attractive, I’ll probably just keep on pounding out prose until my long suffering readers beg for mercy and start throwing tomatoes.

Posted in Blogging | 1 Comment

Listing Org Tags

Chris over at the cpb83 blog solves a problem that many of us probably have. If you’re an Org mode user, you probably make use of the agenda and organize your data with tags. The problem is that if your agenda tracks several Org files, like mine does, and you use tags liberally, you’ll likely forget which tags you have. Was that tag “grocery” or “groceries?”

Swiper and similar utilities help with this a bit but, in the case of swiper, only the first tag for an entry. Chris shows us a bit of Elisp that goes through your agenda files and compiles a sorted list of all the tags in use. That’s a useful thing to have by itself but the code also demonstrates how to search Org files. Org has several functions, such as org-map-entries, that make the searching easier. Chris’ code shows how to do that and can serve as a template to search for something besides tags if you need to.

UPDATE [2017-04-26 Wed 09:19]: The cpb83 blog has been taken down but you can find Chris’ post and the code here.

Posted in General | Tagged , | 8 Comments