Unix Magic

Back in the 1980s Gary Overcare’s Unix Magic poster was a popular item at USENIX conferences. It depicts a Unix Wizard casting his spells in a giant shell surrounded by various Unix paraphernalia.

The meanings of the various parts of the poster have always been a bit mysterious but now David Rio has released an interactive annotated version of the poster. You can click on one of the items and get Rio’s explanation of what it is and what it means. These are Rio’s explanations not Overcare’s so we can’t consider them definitive but by and large they seem reasonable to me.

If you’re an old time unixhead and would like to have your own copy, they’re available.

Posted in General | Tagged | Leave a comment

Emacs And macOS Shortcuts

Watts Martin has an interesting post on calling macOS shortcuts from Emacs. For those who don’t know, a shortcut is sort of like an Applescript script. You can specify a sequence of actions along with some simple looping, give it a name, and call it with a single click or with Siri. If you’re interested, here’s a short introduction.

Martin wanted to capture the weather and location for Org-journal entries as well as a way to add photos to an entry. He couldn’t find a way of doing it directly from Emacs but there were shortcuts that did what he wanted. The problem was how to call them from Emacs and capture their output. Although there is an Emacs shortcuts package it doesn’t appear to have any way of capturing the output.

What to do? It turns out that there’s a shortcuts command line utility that does do what he wants so he wrote a bit of Elisp to call the command line utility and insert the results into the current buffer.

The code is simple as you can see from his post. He also shows the shortcut for picking a set of photos and returning Org links to them. This is a nice solution. Martin leverages a builtin Apple utility to do something that’s not exposed to Emacs and then uses a bit of Elisp glue to make it accessible at the Emacs level. It’s another example—if you needed one—of the power of Emacs to adapt to you rather than the other way around.

Posted in General | Tagged | Leave a comment

Screenshots

Here’s a bit of a palate cleaner to ease you into Monday. Back in 2002, Anders Jensen-Urstad wrote to several prominent hackers and asked them for a screenshot of their desktop. You can see most of them here from when he republished them after 13 years.

His republishing of the screenshots generated a lot of interest so he wrote to the same people asking them for another screenshot. Not everyone answered but some did and Jensen-Urstad published side-by-side screenshots showing then and now1 versions.

None of this matter at all, of course, but I enjoy seeing other people’s desktops and perhaps you will too. One interesting thing was that many of the respondents described their desktops as boring because they consisted mostly of Xterms. Mine used to be like that too until I took up permanent residence in Emacs.

Footnotes:

1

“Now” is 2015.

Posted in General | Tagged | Leave a comment

Packages Or Write Your Own

A reoccurring theme on the Emacs forums is that it’s somehow a good thing to have a minimal configuration and by implication that having a small number of packages is also a good thing. Arguments can be made that a large number of packages can increase load times and memory usage but most of the arguments I see take the position that a small number of packages is an intrinsically a good thing.

Sludgefrog over at the Emacs subreddit makes the argument explicitly. It is, he says, better to write your own extensions instead of adding a package. Even sludgefrog admits that sometimes—when implementing a major mode, for example—a package is the right answer but thinks writing your own extensions is preferable.

There’s a point to made in his favor. In the open software realm—if not in the Emacs world—there are lots of libraries full of trivial functions that are easily implemented in a line or two. That can and has caused problems when the author withdraws the software or a library gets contaminated with malware. That, of course, is the theme of this famous xkcd comic. To some extent those problems are unavoidable but why subject yourself to them to get access to a trivial function?

On the other hand, there’s nothing wrong with using a package even if you could write the code yourself. We only have so many cycles, after all, so in the absence of other considerations, why spend them solving a problem that’s already solved?

The comments mostly take the middle ground that I’ve outlined: sure, write short fixes or functions but use packages for more complicated things unless you want to solve the problem yourself for educational purposes.

Of course, as always Emacs lets you have it your way. You can—more or less—use only packages or you can write everything yourself. Or you can, like most of us, mix strategies and do whatever is convenient in a particular case.

Posted in General | Tagged | Leave a comment

Converting Markdown Text In The Clipboard To An Org File

As I’ve said many times before, I don’t understand why someone would prefer to use Markdown over Org mode but there are such people. At the very least you may be working with outlanders who don’t use Emacs and therefore don’t have access to Org. Regardless, sometimes it’s convenient to be able to convert some Markdown text to Org mode.

Charles Choi has us covered. In this nice post he provides a bit of Elisp that will take Mardown from the clipboard, convert it to Org mode, and insert it in the current Org file. As you probably expect, he uses Pandoc to do the heavy lifting. That means you have to have Pandoc installed, of course. Choi also mentions that you’ll need to have the system clipboard and kill-ring integrated but I think that’s been standard for a long time. I don’t do anything special on macOS although I do have save-interprogram-paste-before-kill set to t.

If you sometimes find that you need to convert Markdown to Org mode, Choi’s code is a good way of doing so. The code itself is easy to understand and modify if you need to. As Choi says, you can invoke the function in several ways such was a context menu, a Hydra or Transient menu, a keybinding, or simply by calling it with Meta+x. Unless you find yourself using it all the time, you’ll probably find Meta+x and command completion more than adequate.

Posted in General | Tagged , | Leave a comment

🥩 Red Meat Friday: Navigating Websites

The other day, I mentioned that I took a long, excruciating train trip. The outbound trip had been so bad that we were confident the trip home would be much better. It wasn’t, of course. Most of you, I’m sure, don’t care very much and those outside the U.S. can snicker and gloat that at least their trains can provide a pleasant experience.

There is an aspect of the whole misadventure that should concern most Irreal readers, though. The Amtrak Website. It’s horrible and turns the idea of being user hostile into an art form. Rather than dwell on the trip, I was going to crawl off into a corner and do my best to never think of it again. But then I saw this xkcd comic. As he so often does, Munroe perfectly captured the infuriating futility that one feels when dealing with websites designed by those suffering from psychopathy.

Again, I’m sure the details won’t interest most Irreal readers so I’ll spare you. Suffice to say, avoid their Website if you can.

Posted in General | Tagged | Leave a comment

Configuring AUCTeX

If you’re an Emacser who writes in LaTeX you’re doubtless familiar with AUCTeX. Most of the time, you can depend on Org mode to do the heaving lifting but when you have a complicated layout you may have to invoke AUCTeX.

Randy Ridenour, a professor at Oklahoma Baptist University, writes in LaTeX using AUCTeX and, of course, wanted to configure it using John Wiegley’s use-package macro. He did what we’d all do:

(use-package tex
    :ensure auctex)

but it didn’t work. It turns you have to do

(use-package tex-site
    :ensure auctex)

instead.

When I saw his post, it rang a bell so I checked my config and I do the exact same thing. I vaguely remember going through the same steps as Ridenour years ago. I no longer recall how I discovered the magic spell but I doubtless found it on the Web somewhere. Ridenour’s problem was getting things to work with Skim. I’ve never used Skim so I had some other problem but the answer was the same.

Once I fixed the problem, I just moved on and so have no idea why you need tex-site instead of tex. I’m sure one of Irreal’s well informed readers will jump in with the answer.

I know this trip down memory lane isn’t all that interesting to most of you but I’m writing about it for the same reason that Ridenour did: to help someone else struggling with the problem find the answer.

Posted in General | Tagged | Leave a comment

Presentations With Org

Ankit Gadiya has a very nice post that explains and demonstrates how he uses Org for presentations. It’s a nice workflow that uses Org, Logos, Olivetti, and Pikchr to create and display his presentation.

Gadiya starts his presentations with an outline. That’s a natural thing to do in Org mode, of course, and he has things configured so that each header and subheader is the title of a slide. That makes it easy to move things around an restructure the presentation.

He uses Pikchr, a Pic-like language for line diagrams. I didn’t know about it and have never used it but I have used Pic a lot and really like it. I’ll definitely be checking out Pikchr since I don’t use the Troff suite much any longer.

A nice thing about Gadiya’s post is that he shows his complete configuration so it’s easy to replicate or adapt it. I like this approach much better than the fancier packages like Apple’s Keynote that I always find difficult to use because they offer so many features.

If you regularly—or even occasionally—find yourself giving presentations, take a look at Gadiya’s post. If you’re an Org user, you’ll find the workflow familiar and easy. He has a lot of good ideas and they’re all documented well in his post.

Posted in General | Tagged , | Leave a comment

I’m Back!

Sorry for the missed posts. I’ve been traveling. On a train. In coach. For about 30 hours. The itinerary didn’t list it but I’m pretty sure we crossed the River Styx at one point. The person behind me was coughing her lungs out and now I have whatever she had and am coughing my lungs out.

Perhaps worst of all for a nerd is that WiFi (and even broadband) was spotty and at one point I had to ask the conductor to reset the router because it wouldn’t complete connections. Oddly, she knew just what I meant and fixed that problem but the broadband—upon which, after all, the WiFi depends—was still unreliable along much of the route.

I’m safely home now at the Irreal Bunker so normal blogging should resume.

Posted in Blogging | Tagged | Leave a comment

Bending Emacs 6: Overlays

Álvaro Ramírez has another video in his Bending Emacs series out. It’s about something that we see all the time but may not even be aware is happening or how it works. The subject of the video is overlays.

Overlays are a way of decorating, changing, or hiding text. A nice feature of them is that the underlying text is not changed. Rather the changes are simply overlayed on top of it and when the overlay is removed, the underlying text in the buffer is revealed again.

Although it may sound complicated or obscure, it’s actually pretty simple: you simply specify the beginning and end of the text you wish to overlay and make a simple call insert the overlay. Ramírez has a bit of code that shows several different type of overlays and invokes them one by one in the video. It’s a nice demonstration because you get to see many of the things overlays can do.

After those demonstrations, Ramírez shows some “experiments” he’s done with overlays. One of them completely change the look of the text by adding images and looking up and adding additional data on the fly. Another takes a regular expression and “redacts” anything it matches by replacing the text with x’s.

The video is 11 minutes, 57 seconds so plan accordingly but it is, believe me, worth a few minutes of your time to explore what’s possible with overlays.

Posted in General | Tagged | Leave a comment