Draft #4, The Book

Those of you who read and enjoyed my post on Draft #4, about John McPhee and why you’re probably using the wrong dictionary, will be happy to know that McPhee has a new book, Draft No. 4, that discusses his writing process.

Speaking of the Draft #4 post, I’m sad to report that the 1913 + 1828 Webster’s Revised Unabridged Dictionary discussed in the post is still off line and we can presume it’s not coming back. Happily, Marcin Borkowski (mbork) has figured out how to install it in Emacs so you can still get access to this wonderful resource.

Posted in General | Tagged | 0 Comments

Magit Kickstarter

Regular readers know that I’m a huge fan of Magit. It is, along with Org Mode, one of the killer apps in Emacs. Now Jonas Bernoulli has announced a Kickstarter campaign to fund further development:

Bernoulli lays out his road map over at the Kickstarter page. He’s got lots of exciting ideas—not least a significant speedup—that will benefit all Magit users. Be sure to take a look at the Kickstarter page to see what he’s proposing.

Bernoulli has done most of the heavy lifting on the Magit project for a long time and certainly deserves our support. I have no idea how many Magit users there are but even if there were only 10,000 and each of us contributed 5(actually5CHFsinceBernoulliisSwiss)theKickstartergoalwouldbemet.Thatsbasicallythecostofalatteoradecentbeersomostofuscanaffordit.Illmakeiteasyonyou:Igoingtocontribute25 and carry 4 others who can’t afford to help.

Posted in General | Tagged , | 4 Comments

Using EDITOR on a Remote System with Tramp

If you SSH into a remote system from within Emacs, you can have problems with the EDITOR environment variable on the remote system. This can arise when you invoke an application that calls the editor specified in EDITOR.

It turns out there’s an easy solution: the with-editor package can take care of this for you. If you’re using magit, you already have with-editor installed. If you’re not using magit, you can install with-editor from Melpa. Better yet, just install magit, you won’t be sorry. In any event, the details are in this very useful Emacs Stack Exchange entry.

If you’re a Tramp user, you really should take a look at the entry.

Posted in General | Tagged | 0 Comments

Org Mode Folding

As every Org user knows, you can use Shift+Tab to cycle the folding of an Org file among OVERVIEW, CONTENTS, and ALL. That’s really handy and something I use all the time.

Yesterday, I learned something new from this Emacs Stack Exchange entry. What happens if you want to unfold, say, the first 3 headers? It’s Emacs so of course there’s a way to do that. All you have to do is specify a numeric prefix argument, n, and the first n subtrees and the contents of the nth level will be displayed.

You probably won’t need that very often but sometimes it’s just what you need and very useful.

Posted in General | Tagged , | 0 Comments

The Map Library

Recently I’ve written about Wilfred Hughes’ ht library for dealing with hash tables and Nic Ferrier’s kv library for dealing with alists and plists. Nicolas Petton commented that there is also the map library, which is built into Emacs as of version 25.2.

What makes Petton’s map library unique is that the functions will operate on alists, hash tables, or arrays so you don’t need to worry about separate functions for each data type. The functions do the expected things such as getting and putting values, mapping over key/value pairs, filtering, and so on.

Unfortunately, there doesn’t appear to be any documentation but it’s easy to look at the source to see what functions are available. The DOC strings do a good job of explaining what each function does.

If you have code that uses two or more of the supported data types, you should consider the map library. It provides a consistent set of functions that operate on them all. In particular, it makes it easy to change the data type of a variable because most of the code to manipulate it will be the same. As with the ht and kv libraries, the names of the functions and the ordering of the arguments are consistent and intuitive. That makes it easy to remember them.

Posted in General | Tagged | 4 Comments

Shannon’s Six Steps to Problem Solving

I’ve written a couple of posts about Rob Goodman’s and Jimmy Soni’s book on Claude Shannon [1, 2]. If you haven’t read the articles that those posts link to, I urge you to do so. Shannon was a fascinating man and a problem solving machine.

In a Business Insider article, Goodman and Soni report on a talk about Shannon’s 6 steps to problem solving that he gave to his Bell Labs colleagues. Most of us aren’t Shannon-level geniuses but his six steps are relevant to the work we do. Briefly, those steps are

  1. Simplify.
  2. Learn and think about similar problems and solutions.
  3. Approach a problem from different angles.
  4. Break the problem into small parts.
  5. Solve the problem backwards: from solution to problem.
  6. Extend your solution as far as it will go.

That list probably seems facile but the article expands on each step and offers examples. It’s definitely worth your time to take a look at the article. You may find some of the strategies useful in your own problem solving.

Posted in General | Tagged | 0 Comments

The kv Library

The other day I wrote about Wilfred Hughes’ hash table library. In the comments, Noonian Atall remarked that Nic Ferrier also has a key/value library (kv) that’s worth taking a looking at.

Whereas Hughes’ ht library is primarily concerned with hash tables, Ferrier’s kv library deals primarily with alists, although it does provide functions for converting between alists and hash tables. As with the ht library, kv provides some naming consistency and saves writing simple conversion and access functions. If you work a lot with alists, you should take a look at this library and see if it can save you some time and work.

Posted in General | Tagged | 4 Comments

The Ugliest Editor Theme Ever Conceived?

Betteridge’s law notwithstanding, I’m pretty sure it would be hard to devise a theme uglier than this one. PLEASE NOTE: That is definitely not a challenge.

It looks like something a particularly silly seventh grader would come up with. All that’s missing are little hearts over the ‘i’s.

Yeah, I get that the perpetrator was just fooling around but somethings are too horrible to see the light of day.

Posted in General | Tagged | 1 Comment

Elisp Hash Table Library

If you like the simplicity and regularity that libraries such as s for strings and dash for lists provide, you should take a look at Wilfred Hughes’ ht library for working with hash tables.

Hash tables are, of course, built-in to Emacs Lisp so the library isn’t introducing any new functionality but it does offer these advantages as listed in the README:

A consistent naming scheme
If you aren’t using hash tables all the time, it’s hard to remember the function names because they seem entirely unrelated to each other. In the ht library, the names all have the form ht-X, when X is usually a verb (such as create) that describes what the function does
A natural and consistent argument ordering
Again, this makes it easier to remember how to use the functions. Of course, eldoc can help here too.
The mutation functions return nil
As in Scheme, these functions end in !. Examples are ht-set! to add a key/value pair to the hash table and ht-remove! to remove a key/value pair.
A more comprehensive set of functions for hash table operations
These make common operations more convenient by providing a function for them so you don’t have to write additional code

The library looks pretty nice if you don’t mind using non-standard names for the operations. Of course, that’s part of the point. The names make more sense and help you remember them. My only complaint with the new names is that the predicates (ht-contains?, ht-equal?, …) end with ? rather than the conventional (for Elisp) -p. (Yes, yes, I know; The ? makes more sense but the -p is a long standing convention worth respecting.)

Posted in General | Tagged , | 1 Comment

Happy Birthday Linux

Linux is 26 today. What started as a little hobby project that even Linus didn’t expect to amount to much has grown into one of the most important operating systems in use today and arguably of all time. Our world1 would be vastly different without it.

Footnotes:

1

By “our world,” I mean the world of engineers and technical people but the case could be made that the statement applies to the “world” in general.

Posted in General | Tagged , | 0 Comments