RC1 for Emacs 26.1

Eli Zarestskii has announced that barring any difficulties coming to
light, the Emacs 26.1 RC1 should be released next week. Zarestskii
expects that that will be followed in short order by the release of
Emacs 26.1 itself.

Relative newcomers to Emacs will see this as simply the usual yearly
release that has become standard for software in our industry. Those
of us who have been around a bit longer know that it wasn’t always
this way for Emacs. Major releases could be years apart and came when
they came. Thanks to recent maintainers—especially John and Eli—we now
have a more predictable (and frequent) release schedule.

It’s good to remember that this is a lot of hard work and it’s all
done by volunteers. Guys like John, Eli, and the other contributors
have families and real jobs that need attending to but still make time
to keep the Emacs project going and flourishing. We all owe them a lot
of thanks.

Posted in General | Tagged | Leave a comment

Lightweight Literate Programming with Hydras

Grant Rettke has an interesting take on abo-abo’s Hydra package. His
idea is that you can use hydras for a sort of lightweight literate
. Most Irreal readers are already aware of hydras’ utility
as a way of gathering related functionality into a menu-driven set of
keystrokes with a common prefix. Hydra functions can be configured to
easily repeat with a single keystroke rather than the longer complete
sequence needed on the first call.

Rettke uses hydras for all that, of course, but he also uses them when
learning a new package or set of related functions. Check out his post
to see how he uses a hydra as a sort of notebook to record what
functionality is available and what keystroke to use to call it. It
is, he says, executable documentation.

Posted in General | Tagged | Leave a comment


Karl Voit captures my feelings about Emacs exactly:

Posted in General | Tagged | Leave a comment


I stumbled across the package Auto-YASnippet, by the prodigious
abo-abo, again the other day. I vaguely remember reading about it a
couple of years ago when it was first released. The idea is to create
a temporary yasnippet on the fly without leaving your current buffer.
That can be really useful when you want to create a series of nearly
identical entries in a program that differ only in a term or two.
Abo-abo describes it as a hybrid of keyboard macros and yasnippet.

You can do the same sort of thing with keyboard macros if you can
remember how to invoke the recursive editing features. Abo-abo’s
solution is much easier: you just write the body of your text, marking
the fields that will change by a ~. Then you can create as many
additional instances as you like, substituting different values for
the marked field(s). Take a look at the README for some examples of
how it works.

I’m not sure why this didn’t register with me more when I first saw
it. It’s probably because I don’t program in languages like Java or
JavaScript where a tool like Auto-YASnippet makes more sense and can
save some time. If you find yourself regularly writing nearly
identical definitions or other boiler plate, take a look at
Auto-YASnippet; it may save you some time.

Postscript: I had originally planned to publish this yesterday but
serendipitously Mike Zamansky scooped me by posting a video
demonstrating Auto-YASnippet in action. As I wrote then, that was
indeed fortunate because now you can see the package in action. If you
haven’t already, be sure to watch the video.

Posted in General | Tagged | Leave a comment

Zamansky 46: Auto-YASnippet

Mike Zamansky has another video up in his Using Emacs Series. This
time he discusses Artur Malabarba’s agressive-indent-mode and
abo-abo’s Auto YASnippet.

In what could be an example of great minds thinking alike but is more
likely simply a quotidian coincidence, I had planed on writing about
Auto-YASnippet today but I got scooped by Zamansky. Actually, that’s a
good thing because now you can see an example of them in action. I’ll
publish my post on Auto-YASnippet tomorrow.

Zamansky’s video is a couple of seconds over 9 minutes so you can
easily fit it in during a coffee break. As with all of his videos,
this one is well worth your time

Posted in General | Tagged | Leave a comment

Log In Zulu

Eric Raymond (esr) says we should always use UTC instead of local
time in our log messages
. Specifically, he says we should use RFC3339
timestamps. Using local timestamps and other ambiguous information in
log entries is a well established practice in the Unix world so esr is
not just complaining about “kids today” when he urges us to use
RFC3339 timestamps.

The problem with local times is obvious when you think about it. With
today’s interconnected world, we’re dealing with events from all over
the world and local times make it hard to compare them. The advantage
of an RFC3339 timestamp is that it is easily distinguishable from
other formats and can be (lexicographically) compared with others of
its kind to determine the temporal order of the timestamps.

An important example of an application where this matters is
distributed version control systems. Commits can potentially come from
anywhere is the world and local times make it difficult to sort the
commits for logging and other purposes. Oddly, Git gets this wrong—or
at least not completely right. While it does store the times in UTC it
displays them in the committer’s local time. That leads to exactly the
type of problems you would expect.

This is, in principal, an easy problem to solve but, of course,
practical considerations will ensure that it probably won’t be anytime
soon. Take a look at esr’s post for more details and for some notes on
how this problem long predates the computer age.

Posted in General | Tagged | Leave a comment

Grepping Git Repositories and Other Collections

My current workflow has two ways of grepping collections of files. For
grepping Git repositories, I use counsel-git-grep. It uses the fast
grep built into Git as a backend. For other collections, I use
counsel-ag, a recursive grep that uses The Silver Searcher for a
backend. I usually prefer to use counsel-git-grep because I can be
in any directory of the repository and still search everything; I
don’t have to worry about starting in the top directory.

Then I read this recent post from abo-abo. In it, abo-abo says that he
now uses counsel-rg, which uses ripgrep as a backend, for everything
because it is the fastest of the generally available greps. That
sounded pretty good but I was confused. As far as I could tell from
the documentation, ripgrep doesn’t treat Git repositories in a special
way. It will simply do a recursive search from the current directory
(or the one you explicitly specify, of course). So I queried abo-abo
about that and it turns out that counsel-rg (as well as
counsel-ag) now explicitly check for a Git repository and will start
from the repository’s top directory unless you specify some other
starting point.

What that means to me is that I don’t need the two ways of grepping. I
can simply use counsel-ag and it will do the right thing if I’m in a
Git repository. That leaves the question of whether I should
install ripgrep and use counsel-rg to do my greps. Ripgrep does
appear to be considerably faster than the other methods but unlike
abo-abo, I’m not dealing with 2G repositories and counsel-ag seems
more than fast enough. Still, it’s always nice to be faster so I installed
ripgrep so that I could try out counsel-rg anyway.

Be sure to read abo-abo’s post. It has some other information on his
workflow and handling such things as ignore files. You might also
enjoy this abo-abo post on ripgrep: he explains why he switched to it
and some of its advantages. And if you aren’t already using the
Ivy/Counsel/Swiper suite, stop what you’re doing and install them
right now. You will, I promise you, be glad you did.

Posted in General | Tagged | Leave a comment

Mind Mapping with Org-brain

If you like to visualize your projects and tasks with mind-mapping, like
to work with an interactive GUI, and don’t mind proprietary software,
you may like The Brain. You can see how it works in this video. It
appears to be an excellent and well thought out product.

But I’m not here to shill for The Brain. I mention it because it’s the
inspiration for a very nice package by Erik Sjöstrand: org-brain. It’s
a concept mapping application built on top of Org mode and Emacs. It does
the same sorts of things as The Brain but from inside Emacs. If you
prefer keeping your hands on the home row to clicking and dragging on
a GUI you should check out org-brain.

You can get an idea of how org-brain works by watching Sjöstrand’s
video demonstration of it. To get the most out of the Sjöstrand’s
video I recommend watching The Brain video first because it helps
clarify the problem both applications are trying to solve and how they
go about it.

I don’t think my mind works in a way that makes mind-mapping a natural
fit for me but lots of people I know and respect make it an important
part of their workflow. If you’re one of those people, you should
definitely take a look at org-brain.

Posted in General | Tagged , | Leave a comment

Zamansky 45: Autocomplete and Company Mode

Mike Zamansky has a new video up in his Using Emacs Series. After
commenting on what a great time it is to be an Emacs user, Zamansky
considers Autocomplete and Company mode. These, of course, are
completion packages for Emacs. They’re both “intelligent” in the sense
that they use individualized backends to be language aware.

Until recently, Zamansky was an Autocomplete user. He mostly used it
with the Jedi package for Python completion. This semester, though,
he’s teaching a C++ course and decided to try out Company mode because
it uses Clang (through Irony mode) to provide syntax aware completion
for the C, C++, and Objective C languages.

He’s just started his experimentation so the video represents his
preliminary findings. For me, though, the video reinforced a
long-standing prejudice against either one. I use the “dumb”
completion built into Emacs that basically looks at what’s in your
buffer and what you’ve typed recently to choose completion targets.
You have to explicitly invoke the completion so it never gets in the
way. Autocomplete and Company mode, on the other hand, are always
popping up buffers offering suggestions. I find that annoying and
distracting. Perhaps it’s because of my horrible experience with
Word-like word processors
but whatever the cause I don’t want my
editor doing that. Some languages—I’m looking at you Java—can benefit
from auto-completion, I suppose, but I don’t use those languages so I
have no need to put up with its downsides.

Of course, not everyone is as curmudgeonly so it’s worth taking a look
at the video to see if one or the other works for you. The video is just
short of 18 and a half minutes so it should be easy to fit it in.

Posted in General | Tagged | Leave a comment

Radio Buttons and Devops in Org Mode

Regular readers know that I am very enamored of Howard Abrams’
excellent post and video on literate devops. It’s not that my duties
include devops; rather it’s that the methods he demonstrates are
applicable to a wide range of problems that we encounter in the
technical fields. The idea of maintaining a little “notebook” that
describes a problem and its solution—along with any code used in that
solution—is a very powerful technique. It’s one I’ve been trying to
apply in my day-to-day tasks.

It turns out that Matúš Goljer (Fuco1) feels the same way. He has a
really great post that begins by sketching out a typical use of the
technique. He was working on a personal version the app stack where
the problem occurred and wanted to repeat the process on the staging
and production systems. Everything was the same between the systems
except the port number used to access the pertinent database.

Easy enough, just change the port number and rerun things. But that
port number was used in several places so rather than replace them all
he made another code block that returned the port number and accessed
it with org-babel-ref-resolve in every code block that needed it.
Now he simply needed to change the port number in one place to access
any of the systems.

He works with a lot of systems so it became difficult to remember the
port number for any given system. He solved that problem by adding a
list of port numbers above the code block that returns the needed port
number. Then he thought that, gee, that looks just like a set of
buttons that I should be able to click on to choose the right port.
What he really wanted, of course, was a list of radio buttons. Org
doesn’t support that but John Kitchin had a post with some code for
doing it.

Fuco1 refactored Kitchin’s code, packaged it up on GitHub, and then
used it in his notebooks. Now when he wants to run things on a
different system, he just clicks on the target system and everything
else is taken care of. This is a really brilliant solution and his
post is a must read for anyone who want to use Abrams’ techniques in
their own work.

Update [2018-03-11 Sun 14:44]: Matus → Matúš.

Posted in General | Tagged , | Leave a comment