Navigating to a File

If you're like most people, you access your files by navigating down the directory structure to them. That's not the only possibility though. You could also use one of the search engines built into your operating system. If you can't remember where a file is, you may have to use this method.

It turns out though, that people prefer navigating to files over searching for them. Looked at rationally, that seems backwards. Most times search is faster both when storing files and when locating them. Karl Voit, whose tweet lead me to the video linked below, has done extensive research in this area and uses a file naming convention that aids in using search techniques for locating files. Still, most people prefer the navigation method.

Ofer Bergman has a very short video (1:42) that explains why this is. The video is so short and to-the-point that giving a TL;DR doesn't make sense. Just go watch it; it's interesting and helps explain why search-based file handling hasn't taken off.

Posted in General | Tagged | Leave a comment

Entering Accented Characters in Emacs

John D. Cook points out that it's pretty easy to enter accented characters, ç, ü, é, etc., in Emacs by typing【Ctrl+x 8】followed by a punctuation mark and letter. For example, to get ç you type 【Ctrl+x 8 , c】. Cook's post has a chart of the possible accented characters.

I prefer to use the TeX default input method for entering accented characters but the method that Cook describes works well too. There are more possibilities than those in Cook's chart. The easiest way to see them is to type 【Ctrl+x 8 Ctrl+h】.

Posted in General | Tagged | 2 Comments

Happy Birthday!

Today Ken Thompson is 72. Happy Birthday, Ken, and may you have many many more.

UPDATE: Well actually it's tomorrow so consider this early birthday greetings.

Posted in General | Tagged | Leave a comment

Blogging with Org Mode (Only)

Dennis Ogbe has a blog that he writes in Emacs with Org mode. There's nothing unusual about that, of course; lots of people do. All Irreal posts begin life as an Org file that is exported to HTML and pushed to my WordPress site by the excellent org2blog/wp package. What makes Ogbe's blog different is that everything (posts, archive, RSS feed) is generated as static pages directly from Org mode. There're no external packages to worry about; it's all just Emacs and Org mode.

In an interesting post, Ogbe describes how he does this. Many of us use Org mode to write content and export it to HTML but Org mode provides a much more comprehensive functionality with its publishing system. Ogbe uses this to describe his site and take care of most of the details of publishing it automatically. He chooses to rsync the completed HTML to his hosting provider manually but that, too, could be done automatically by leveraging Tramp.

I prefer to let WordPress worry about RSS, the archive, and things like that but many bloggers would rather have a simple system with static pages and the simplicity (and security) that they enable. If you're one of those people, take a look at Ogbe's post; it can serve as a useful go-by for rolling your own. Be sure to check out the three example sites that Ogbe used as his own go-by. They have lots of good ideas too.

Posted in General | Tagged , , | Leave a comment

Emacs pcase

Pattern matching is a powerful paradigm in programming. Recent versions of Emacs Lisp implement this paradigm with the pcase macro. Unfortunately, pcase can be a bit difficult to understand. Fortunately, our Emacs maintainer, John Wiegley, has published an excellent tutorial on its use.

The tutorial doesn't address how to leverage pattern matching in your programming but it does cover the use of pcase. It's a powerful idea and can often be useful. Take a look at Wiegley's tutorial to get started.

Posted in Programming | Tagged | Leave a comment

Inserting an Org Date Quickly

Here's a useful tip:

It's obvious, of course, but for me, at least, it's a subtly different way of thinking about it. Instead of the two step process of bringing up the Org calendar dialog and then choosing a date, you do it in a single operation: 【Ctrl+c .friReturn】.

It's worth pointing out that the above operation inserts an active date. If you want an inactive date use 【Ctrl+c !friReturn】 instead.

Posted in General | Tagged , | 2 Comments

Praising the Command Line

Stephan Ramsay has an interesting series of posts in which he takes the retro position that the command line is superior to a GUI. Even more radically, in the current milieu, he argues that the average user—the ever popular man in the street—would find the command line easier to use than a GUI if he could be persuaded to try it. In Life on the Command Line and The Mythical Man-Finger he explains why he thinks this is true.

Ramsay isn't one of those annoying people who does things like living without electricity for a week to make some silly point and show he can. As far as the command line is concerned, he walks the walk. He notes that he has almost completely stopped using graphical tools on his computer and that when he does it's to surf the Web.

To illustrate his point, he starts with email. GUI email programs are slow and waste time. Why, he asks, does Gmail start so slowly that it shows you a progress bar? He compares that to a text-based email client like mutt or pine where you simply type the name1 to start the app and bang! you're looking at your mail. Type another key and the app quits and is gone. All without taking your hands off the keyboard.

If you choose the right text-based email client, you can integrate your email with the rest of your system to perform tasks that the client itself doesn't support. Ben Maughan's post on how he handles email with mu4e is an excellent example of this. Maughan shows how he can search for emails, integrate an email into a TODO list, and easily archive those he wants to save all from the keyboard.

In the second post Ramsay takes up the complaint that he's a power user and what he does is beyond the capabilities of the average user who just want things to work. While acknowledging that he is a power user, he emphatically denies that using the command line is harder than using a GUI or beyond the average user's capabilities.

In the first place, the ergonomics of a GUI make interacting with it slower and clumsier. If you're having to take your hands off the keyboard to move the mouse around and click on things, you're going to be slower than if you can type a key or two to do the same thing. Navigation can be more difficult too. If you have to pull down and menu and search for the right action, it's going to be harder to do what you want to do.

To illustrate this, he considers a notional command line music application. Instead of bringing up a GUI, scrolling around looking for the track you want and clicking on it, you merely type

play "Comfortably Numb"

Want to hear it again?

play last

In the mood for more Pink Floyd?

play pink-floyd

Ramsay goes on to show various other music player tasks that fit nicely into this paradigm. It is, he argues, easier and more natural than trying to do the same thing with a GUI.

Finally, in The Man-Finger Aftermath he discusses some of the points raised in the comments to his posts.

As retro as all this sounds, I realized that I do essentially the same thing because I mostly live in Emacs. Sure, I use the browser a lot but other than that, almost everything I do is in Emacs and while it's not strictly speaking a command line, it comes down to the same thing. A lot of the time, I'll pop into eshell to use some tool that's not integrated nicely into Emacs.

Like Ramsay, I find working from the command line or Emacs much easier than messing around with the mouse and clicking on things. Whether that's true for everyone, I don't know but it's worth pointing out that it used to be that the command line was the only thing available and somehow the average user managed.



Or better yet have a hot key that starts the application automatically. That makes a lot of sense for applications that you use frequently.

Posted in General | Tagged , | 1 Comment

Org Agenda Capture

As often happens in Emacs, I hit the wrong key and stumbled upon a functionality I didn't know about. It turns out that if you press 【k】 while in an Org Agenda buffer you will bring up a capture buffer for the date of the entry at point. How is this useful?

Suppose you have a journal or some other Org file organized as a date-tree and you remember that a couple of days ago you forgot to enter some event. You can go to the Org file and enter it by hand but the date-tree makes getting that correct fussy. It's far easier to bring up the agenda, put the point on the date you want, press【k】and enter the information in the capture buffer as you normally would. The difference is that it will be put in the correct place in the date-tree.

This isn't something I, or you, will need to do often but when you do it's a real win. So much easier than trying to insert the entry in the date-tree by hand.

Posted in General | Tagged , | Leave a comment

Emacs 25.1 Pretest

Emacs 25 is drawing nigh. If you can, download the first pretest and help stamp out any remaining problems.

Posted in General | Tagged | Leave a comment

The char-menu Package

I just updated my ELPA packages and noticed the new package char-menu. It allows you to make a (possibly tree-structured) list of characters that you might want to add to an Emacs buffer. The obvious examples are round quotes—single: ‘’ or double: “”—, em and en dashes, arrows, and, perhaps, Greek letters.

This can be done in stock Emacs with the 【Ctrl+x 8】 prefix, of course, but then you have to remember the Unicode name for the character you want. In Org mode, a lot of these things are available with standard TeX shortcuts or by setting the input method to TeX. Still, you have to remember the names or shortcuts and it's often clunky to use them. With char-menu, you hit a single shortcut key and you get a menu of the characters to insert.

The menu is Avy-based so it's familiar and easy to use. The GitHub page for char-menu shows a simple list or characters and a more complex set with multiple levels. For my initial configuration I used the complex set minus the Greek letters. Here it is:

(use-package char-menu
  :ensure t
  :bind ("H-s" . char-menu)
  :config (setq char-menu '("—" "‘’" "“”" "…" "«»" "–"
                            ("Typography" "•" "©" "†" "‡" "°" "·" "§" "№" "★")
                            ("Math"       "≈" "≡" "≠" "∞" "×" "±" "∓" "÷" "√")
                            ("Arrows"     "←" "→" "↑" "↓" "⇐" "⇒" "⇑" "⇓"))))

I'll probably modify this based on my usage but it's a good beginning.

One other feature of the package is that when you have a pair of characters, such as quotes, char-menu will put the point between them. If you have highlighted text, char-menu will wrap the text with the two characters. It's a very nice and light weight solution to adding UTF-8 characters to your Emacs buffers.

Posted in General | Tagged | Leave a comment