Find Commits Affecting a Function

Here’s a really useful tip from Wildred Hughes’ Emacs Command of the Day:

It’s just another way of looking at how your code has evolved but it’s one that could be very handy when debugging a problem with a particular function.

It’s sort of like magit-log-buffer-file that I wrote about previously but specialized to a particular function rather than the whole file.

Posted in General | Tagged , | Leave a comment

Afterword to Kernighan’s Grep Video

Speaking of Brian Kernighan, grep, and codas, there’s a (very) short afterward to Kernighan’s excellent video telling the story of the origin of greps’s name. At the end of that video (if you haven’t watched it, you definitely should) Kernighan describes a programming challenge he used to assign to his students. Many of the comments to the original video asked how well they did with it.

The afterward answers that question as well as what editor Kernighan is using now. Spoiler: it’s not, of course, ed but he does say that he’ll occasionally fire it up for a short job or if he wants to script an editing job.

The video is just a bit over 2 minutes and provides a nice ending to the original video. If you liked the grep video, you’ll doubtlessly enjoy this one too.

Posted in General | Tagged , | Leave a comment

A Q&A with Brian Kernighan

If you enjoyed Brian Kernighan’s video on the genesis of the name “grep”, you will probably also enjoy the three-part Q&A with Kernighan in which he discusses programming, C, and C’s successors.

Kernighan is personable and a great speaker so the videos are easy to watch and absorb and, of course, they’re interesting. It turns out the along with the languages you’d expect, Kernighan also coded in what he describes as the world’s worst COBOL.

He makes a point that is often forgotten today. In the days of early C, it was the best language for text manipulation even though it’s not really a very good language for it. That’s undoubtedly why most of the Unix utilities (as opposed to the OS itself) were written in C.

Each of the three videos are short. The first one is here. There are pointers to the next in the comments below each of the videos.

Coda

Since I wrote this, Mike Zamansky has published his own post on these videos. Zamansky has an interesting story about Kernighan that restates something I’ve read many times over the years: Kernighan is a really nice guy who will go out of his way to be helpful even if he doesn’t know you. Be sure to check out Zamansky’s post too.

Posted in General | Tagged | Leave a comment

Three Emacs Modes for Note Taking

Irreal readers can’t help but know that I’m a fanatical Org mode addict. I use it for almost everything that doesn’t involve coding and sometimes, via code blocks, even then. I’m an inveterate data gatherer and note taker and all that data and notes go right into Org files.

Still, not everyone is as fond as I am of Org mode but they still need to take notes and collect data. There are lots of ways of doing that, of course, but if you’re an Emacser who hates leaving Emacs, you’ll want a way of taking notes from within Emacs.

Scott Nesbitt offers 3 Emacs modes for taking notes. One of those, of course, is Org mode and I’ve written at length about its virtues for note taking and other tasks. The other two are deft-mode and howm.

I’ve written about deft before (1, 2, 3, 4) and lots of Emacs users—including Org users—swear by it. It’s main attraction appears to be the ease with which you can search and filter the notes. I use tags in Org mode for that and have never seriously used deft but, as I say, lots of knowledgeable people have and love it.

Finally, there’s howm. I’d never heard of it before I read Nesbitt’s post so I can’t add anything intelligent to the discussion about it. Nesbitt says it’s a bit quirky but that he really likes it. You can get an idea of what it’s like by following the howm link above.

As usual, Emacs gives you lots of opportunities to do it your way.

Posted in General | Tagged , | Leave a comment

DHH on Open Offices

David Heinemeier Hansson has a nice article on open offices: The open-plan office is a terrible, horrible, no good, very bad idea. He cites the usual research showing that purported gains in interaction and communication just don’t happen and that productivity for thought workers is severely damaged. Most everyone knows this.

There are, DHH says, a minority of people who enjoy the environment but it seems unlikely to me that they’re going to be the productive ones. Judging from the comments, those that liked open offices liked them because it allowed them to do all the things that make them so horrible for everyone else: easy talk to colleagues, see what everyone is doing, and so on. There are, I’m sure, a few people who like open plan offices and still manage to be productive but I’m betting they’re a minority of the minority.

Another interesting point that emerged from the comments is that no one is fooled by all the management babble about collaboration and increased communication. They all know that that’s a lie intended to sugar coat the real reason that is, of course, reduced costs. Other commenters note that management never avails themselves of all the reputed advantages, preferring to inflict those advantages on others. The situation would be slightly improved by a little less hypocrisy on the part of those who decree it for others but not themselves.

Whatever your feelings on the matter, it’s a good article and the comments are worth reading too.

Posted in General | Tagged | Leave a comment

More YASnippet Templates

I’ve mentioned before that I’m a YASnippet user and really like the system. Not everyone agrees but you owe it to yourself to give them a try. If you are a user, you might not be aware, as I wasn’t, that there’s a package of additional templates.

RmberYou has a post that describes the package and how to configure it. A glance at the source directory gives you an idea of the many modes that the snippets cover.

Despite my best intentions, I seldom use any templates except the ones I’ve written myself. Mostly that’s a matter of being too lazy to learn what’s available and memorize their names. If you, on the other hand, don’t want to bother writing your own templates and would like a nice collection of prefab snippets, this package could be just what you’re looking for.

Posted in General | Tagged | Leave a comment

Building an Initial Emacs Configuration

One of the problems—perhaps the major problem—that a new Emacs user faces is building an initial configuration. One would think that a vanilla install would be a good starting point for a new user but we all know that that initial install is not going to deliver a very good experience. Mostly that’s because even if you’re interested in Emacs strictly as an editor, it’s most usefully thought of as an editor construction kit. Even at the start, you need to do a bit of customization.

Huy Tran has a post that can help the n00b out. His post, Emacs from scratch, outlines a minimal configuration to get the new user going. It’s oriented towards a Spacemacs-like setup but even a relative new user should be able to include or exclude those parts as desired.

The major parts of the configuration are:

  • Getting rid of the menu bar, tool bar, scroll bar, and tool tips.
  • Setting up the package manager including making sure that the use-package macro is loaded.
  • Enabling evil mode and other basic Vim comfort settings.
  • Installing a theme.
  • Installing Helm.
  • Installing which-key.
  • Setting custom key settings.
  • Installing and configuring projectile.
  • Installing neotree and icons.

He also configures a bit of macOS specific data that a new user probably shouldn’t worry about.

I disagree with the Helm installation, not because there’s anything wrong with Helm (although I prefer Ivy) but because it’s not something a n00b should be worrying about initially. I also don’t care for neotree but perhaps it’s helpful for n00bs and it probably doesn’t hurt to install it.

If you know someone who’s new to Emacs and looking for an initial configuration to get started, this is a good resource.

Posted in General | Tagged | Leave a comment

Emacs As an Editor

Over at the Emacs reddit, honeywhite wonders why anyone would use the Emacs default key bindings. He’s an Emacs user but can’t understand why anyone would prefer the standard Emacs key bindings to one of the Vi emulation modes.

As most of you know, I was a Vi user for more than a couple of decades and then moved to Emacs. When I did, I went all in and learned the Emacs key bindings. It was a bit hard rearranging my muscle memory but now I’m perfectly happy with the Emacs bindings.

Honeywhite’s real objection to the standard Emacs editor is that commands generally require a key chord but that’s because Emacs, unlike Vi(m), isn’t modal. If your editor isn’t modal, you’re pretty much stuck with key chording (or menus/arrow keys). Oddly, honeywhite doesn’t mention the real advantage of Vi key bindings: they’re composable. Once you’ve learned the movement keys and that d is for “delete,” you automatically know how to delete just about everything. That’s a very powerful abstraction that Emacs lacks.

Fortunately, Emacs has both camps covered. If you hate key chording, you can use one of the Vi emulation modes. If you can’t put up with modality, you can use the standard bindings. I like both systems but decided to learn the Emacs way when I switched. That’s just me; you can switch and (mostly) bring Vim with you if you prefer.

Posted in General | Tagged | Leave a comment

Run a Raw Git Command From Within Magit

There isn’t much git work that you can’t do from within Magit but occasionally it’s convenient to call git directly. In another great tip from Wilfred Hughes’ Emacs Command of the Day we have:

You probably won’t use it often but it’s really nice to have the capability.

Posted in General | Tagged , | Leave a comment

Dired Hacks Redux

Back in 2015, I wrote about Fuco1’s dired hacks. It’s a collection of packages that make working with dired more convenient. You can read the original post or take a look at the dired-hacks GitHub repository to see what’s available.

There’s a lot there and it takes a bit of time to read through it all but you’ll probably find several ideas to improve your workflow. Even though the project is old, development is continuing and Fuco1 is still adding new packages to the collection.

If dired plays a central role in your Emacs use, you should definitely take a look at these packages.

Posted in General | Tagged , | Leave a comment