The Emacs Help System

Over at the Emacs Elements Channel there’s another useful video up. This time it’s about the Emacs Help system. The majority of experienced Emacs users will already be familiar with most of the material but if you’re a learn-as-you-go user, there may be some information new to you.

The first thing is that Ctrl+h Ctrl+h will show you a list of all the help commands. If you’re like me, you know this but always forget it when you’re trying to remember a help command. There are a lot more commands then the ones you use everyday so it’s worth your while to type Ctrl+h Ctrl+h to see what’s available.

For example, I’d completely forgotten about Ctrl+H w to discover the shortcut for a given command. My usual procedure is to bring up the documentation for the command and get the information there but I’m going to try to remember to use Ctrl+h w instead.

Another thing that I learned from the video is the difference between scrolling up and down with Space and Delete versus the <PgUp> and <PgDn> keys. I’ll let you watch the video to see what that difference is.

The video is 14 minutes 52 seconds long so it shouldn’t be too hard to find time but you may have to plan ahead.

Posted in General | Tagged | 0 Comments

PSA: Elisp Has Builtin Threading Macros

I’ve written about Clojure’s threading macros and their implementation in Elisp before [1, 2, 3, 4, 5]. I like them but almost always use the traditional composition of functions instead. That’s probably because being a mathematician it seems natural to me. Still, the threading macros are easier to read and understand.

Most people who care about such things know about Magnar Sveen’s implementation of these macros in his Dash library. They have the advantage of using the same names, ->, ->>, etc. as clojure. Of course, you have to install Dash to use them. That’s not much of a problem because so many packages use Dash that it’s probably already installed.

But what if you don’t want the dependency? It turns out that Elisp has the most important of these macros built in and has since at least Emacs 25. The first, thread-first corresponds to -> and the second, thread-last, corresponds to ->>. They live in the sub-x.el file if you want to check out there definition.

Ruslan Bekenev has a page that explains all this and even gives a short explanation of how to use the macros. If you’re interested in the threading macros, take a look at his post.

Posted in General | Tagged | 0 Comments

Elfeed-webkit Update

The other day I wrote about installing elfeed-webkit to render my RSS feed as proper HTML. I was pretty impressed with it when I first tried it and now I’m even more of a fan. Before elfeed-webkit, I spent a lot of time switching between Elfeed and Safari so that I could read interesting posts that came up in the feed. It doesn’t seem like it would take that much time but since the change, my RSS workflow seems faster and easier.

A secondary advantage is that Emacs has more functionality now that I have XWidgets enabled. At first I wondered if I could get eww to do a better job rendering sites by using Webkit. That turned out to be a bust but I did discover xwidget-webkit-broswse-url that will render a site in decent HTML but it’s not a proper Browser so it’s pretty much restricted to viewing a specific URL. You can follow links and control videos but there are no bookmarks, content filtering, or other Browser amenities. Still, it does help keep me in Emacs and a lot of times I just want to visit a page from Emacs and it works perfectly for that.

In my original post, I noted a couple of problems. The first was the possibility of being inundated with ads because of the lack of content filtering. That’s basically a nonissue for the sites I read although occasionally a feed item will send me off to a “commercial” site that does have a lot of intrusive pop-up adds but it doesn’t happen often.

The second problem was that I couldn’t get t to toggle elfeed-webkit on and off. I thought maybe something else was grabbing the t binding to I changed it to w but that didn’t work either. I solved that by binding a global key to toggle elfeed-webkit and that worked fine (but see below).

Finally, I recently upgraded my email client mu/mu4e and a helper function I wrote to display the post in eww stopped working. While investigating that, I discovered that mu4e will display an email with webkit, which is what I really want so I’m now using that instead of eww.

While investigating the email issue I discovered that the XWidget library does indeed capture the t key as well as the w key. The t doesn’t appear to do anything useful as its definition

(define-key map "t" (lambda () (interactive) (message "o"))) ;FIXME: ?!?

shows. I don’t know how it was working for Grabo; perhaps he’s using the Emacs 29 pretest and it has removed the useless binding. In any event, I simple changed my toggle key to x and now it works perfectly.

That leaves only one small problem. One of the sites I follow, Daring Fireball, has the unusual property that its RSS URL is not the site itself but the site it’s linking to. That means that I miss the Daring Fireball commentary and go straight to the linked site. I’m considering adding code to implement a tag that inhibits rather than enables elfeed-webkit. In the meantime, I’m simply toggling elfeed-webkit off when I get to a Daring Fireball post.

All in all, I’m really happy with elfeed-webkit and recommend it wholeheartedly.

Posted in General | Tagged | 5 Comments

Org Blk URI

Just a quickie. I stumbled across a post from Andrea that describes his package Org Blk URI. It’s pretty simple: it’s just a way of extracting the content at a URL into an Org source block.

That’s handy for capturing Web content that is apt to be ephemeral. The example Andrea gives is a job ad and, of course, we’ve all run across Web pages that might not remain available but that we’d like to retain. This package is a nice way of capturing them into an Org file that we control.

I haven’t installed yet but it seems like a handy tool to have.

Posted in General | Tagged , | 0 Comments

PDF at 30

PDF. It’s a ubiquitous standard that seems like it’s always been here. How else would you prepare a document that could be printed on virtually any printer or displayed on any screen in the best possible resolution?

But, it turns out, PDF is only 30 years old and even after its introduction, it took a long time to gain traction. When Rich Stevens published the first edition of Unix Network Programming in 1990, he hand carried the Troff output on a series of floppy disks to a typesetting service that printed camera ready copy for his publisher. Things got better. When I published my first book—also written with Troff—I simply emailed the PostScript files to the (same) publisher. By the time I completed my second book, the publisher said, “Just send us a PDF file.” Now PDF is the universal file format for producing human readable print quality output.

The incomparable Professor David Brailsford on Computerphile remembers the early days of PDF and how it completely changed his career. Even he, he says, underestimated how long it would take PDF to gain traction. Part of what moved things along was the introduction of laser printers that, although they didn’t provide the resolution of a traditional typesetter, were good enough.

Soon, of course, they were more than good enough, equaled the resolution of the old guard typesetters, and replaced them. These days, even industrial printers are laser based and all input comes to them as PDF. The ’P’ stands for “Portable” after all and it has more than lived up to its promise.

Posted in General | Tagged | 0 Comments

Red Meat Friday: Latex vs. Word

The minions hate Word even more than they hate dark themes so they insisted I run with this:

Like last week’s Red Meat Friday, you’d think this one is so non-controversial that it hardly merits inclusion in a Red Meat Friday post but according to the comments, some people actually defend using Word instead of LaTeX for mathematics.

To those who think this, I can only second the look from the two women in the front of the picture. Actually, I’d go further and extend that unbelieving look to anyone who uses Word for any writing. But that’s just me. And the minions.

Thanks to John Cook and his TeX and Typography feed for the link.

Posted in General | Tagged | 2 Comments

Elfeed-webkit

I just stumbled across a post by Fritz Grabo about his package elfeed-webkit. When I first saw it, I thought it was interesting and worth a look. After reading more about it, I knew I had to install it. That wasn’t entirely easy because I had to recompile my Emacs to support xwidgets. But I liked the idea of the package enough to press on and add xwidgets to my Emacs.

After that, it was simply a matter of installing elfeed-webkit from MELPA. When I toggled it on with Meta+x elfeed-webkit-toggle all my elfeed results were rendered directly in the Elfeed buffer. Sometimes—for example, when I want to save a page for an Irreal post—I need to go to the browser and rerender the page. That’s simply done by pressing the v key.

You’re supposed to be able to toggle elfeed-webkit on and off with a t after you configure it in your init.el but I can only get it to toggle on, not off. Doubtless, I have some misconfiguration but that’s research for another day. You can also add a tag to individual feeds to turn it on but I haven’t tested that yet (I installed it just before I started this post).

So far, I really like this package. It (mostly) keeps me in Emacs and renders the pages perfectly. A comment in the original reddit post complained that Webkit was going to deluge my feeds with dozens of ads but I didn’t notice that with my admittedly limited testing. The nice thing is that you’re not really committed. It’s easy to turn it off or even uninstall it if you don’t like it. The worst that happens is that you end up with support of xwidgets in your Emacs.

Posted in General | Tagged | 1 Comment

Emacs Badges

As far as I know, it started with this reddit post. It was a request for a “built with Emacs” badge. Those badges were the type of thing you used to see on Web sites. I’m pretty sure I had it on one of my old Web sites1 but I don’t see them as much now. In any event, MichalNemecek had seen one for Vim and wanted to put it on his site. The problem was that he’d switched to Emacs and was looking for something similar for Emacs users.

Since then, I’ve seen several mentions of this page from Lulu Cathrinus Grimalkin that has a collection of Emacs badges. It even has the famous—or is it infamous—kitchen sink Emacs badge. If you’re into this sort of thing and would like to add an Emacs badge to your site, Grimalkin’s page is a handy reference.

I’m guessing that the reason you don’t see these very much anymore is that blogs and sites are mostly no longer handmade but use something like WordPress, Hugo, or one of the other site generators. That and the fact blogs are no longer the exclusive domain of nerds. These days, the average blogger has probably never heard of Emacs or Vim.

In any event, if you want one of those badges, now you know were to find it.

Footnotes:

1

After I wrote that, I remembered that I had something similar (but for Org mode) on the placeholder for my “new” Web site. Of course, that was 12 years ago so my point stands.

Posted in General | Tagged | 0 Comments

Emacs Elements on Emacs Regular Expressions

Over at Emacs Elements there’s a nice video that explores Emacs regular expressions. One the one hand, virtually everyone hates Emacs regular expressions and wishes that Emacs used Perl compatible regexes instead. On the other hand, a case can be made that Emacs regexes are optimized for the typical Emacs use cases. In either case, it’s an old war and a boring one. One can arrange to use Perl regexes but most of us just accept the pain and use the default.

Still, even for those of us who have accepted the inevitable, the rules governing Emacs regexes can seem arcane and sometimes needlessly complex. Why, for example, do we have to use [0-9] instead of \d to specify a digit?

Emacs Elements’ latest video is a nice précis of the rules and conventions for using regexes in Emacs. The three parts that I really liked were

  1. Listing the exact characters that need to be escaped
  2. A good explanation of how to search using syntax classes
  3. An explanation of the non-greedy operators

but the video covered most aspects Emacs regular expressions and is a good explanation or refresher for those who have occasion to use them. The video is 22 and a quarter minutes so you’ll probably have to schedule some time but it’s definitely worth watching.

Posted in General | Tagged | 0 Comments

The Story of Mel

There’s a charming piece of foundation lore that every programmer in my cohort read and admired: The Story of Mel. Even when I was writing assembly language exclusively, the story was about a bygone era and techniques that no one still used. But Mel was cast as a “real programmer” of the sort no longer extant but nevertheless worthy of our praise and admiration.

I don’t know if younger programmers know about Mel so if you don’t, follow the link and read the story of Mel. I’ll be here when you get back. Even when I was young and naive, I didn’t believe the story was real and always considered it an apocryphal story about a sort of Platonic ideal of the perfect programmer. Everyone I know shared that opinion.

It turns out, though, we were all wrong and Mel really did exist and really did write the famous Black Jack program. His name was Mel Kaye and was still alive until 2018. You can read all about Mel and his family tree back to when his ancestors came to America at the link.

Apparently, the hack described in The Story of Mel is real too. The idea of that sort of bit twiddling, let alone optimizing your code for drum memory, is completely foreign to the current milieu but it did once exist and we can only marvel that it was once real.

Posted in General | Tagged | 2 Comments