What’s New in Emacs 30

Emacs 29.1 was just released and most of us are still exploring it’s new features. But time and tide wait for no man and neither, apparently, does Emacs so of course work is already underway on Emacs 30. It seems silly to be talking about Emacs 30 already but it’s always good to know what’s coming and maybe even contribute to the new release in some way.

Emacs Elements has risen to the challenge with a video on what’s new in Emacs 30. Based on the video, Emacs 30 will not be the huge update that Emacs 29 was but, of course, it’s still early days and there’s plenty of time to add important new features.

The video is only 8 minutes so it should be easy to fit in. Here’s a list of the new features covered by Emacs Elements:

  • X selection requests are faster
  • write-region-inhibit-fsync defaults to t.
  • New options for remote files.
  • yes-or-no-prompt configurable
  • New face for display-time-date-and-time.
  • New icons for general use.
  • The tool bar can be put at the bottom of of the frame.
  • cl-print improved.
  • Ability to right align mode line elements.
  • Emacs supports input methods performing string conversion on X.
  • New Command: kill-matching-buffers-no-ask.
  • New flexibility in displaying grep results.
  • Eshell aliases can be loaded interactively.
  • In eshell, rgrep is builtin.
  • New command to indent docstrings or comments in functions.
  • New customization options for dictionary-search.
  • New Modus themes.
  • New/Changed byte-compilation warnings.

Take a look at the video for more details on these changes.

Posted in General | Tagged | Leave a comment

How To Contribute To Emacs Core

Emacs 29 has just been released and as I always do, I thanked the developers who worked so hard to bring it to us. Eli Zaretskii and a handful of others do much of the heavy lifting but there are many contributors who produce only a few—maybe even one or two—contributions per release.

Many of these folks simply had an idea that they wanted implemented or found an obscure bug and fixed it. They are people just like you and me who had an itch and scratched it. Even folks who aren’t proficient in Elisp can still help with, say, documentation.

The problem is that contributing to Emacs is an arcane process and can be daunting to a first time contributor. Happily, Protesilaos Stavrou (prot) has come to the rescue with a video on contributing to Emacs core.

The worst part, if you’re an engineer who hates paperwork and bureaucracy, is assigning your copyright. You’ve got this wonderful patch that you’d like to see installed and they tell you need to fill out a form assigning the copyright to the FSF. It wouldn’t be so bad if you could just fill it out and send it in but you have to wait for the FSF’s reply with an agreement for you to (digitally) sign and then wait again for their reply with your contributor number or whatever they call it. In my case that took at least two or three weeks.

Prot doesn’t spend much time on the agreement. Rather he focuses on the mechanical aspects of generating and submitting your change. It’s really useful information for the first time contributor and can save you a lot of time instead of trying to figure it out yourself.

The video is 21 minutes, 42 seconds so you’ll need to schedule some time. If you’re new to the process, you’ll find it time well spent.

Posted in General | Tagged | Leave a comment

Emacs As A Window Manager

I just ran across a post from the estimable Howard Abrams on using Emacs as a window manager. There are two dates on the post, 2015-01-12 and 2023-01-11, so I’m not sure of its birthdate but either way the post seems applicable today.

Abrams starts by noting that when he takes on a new job the first thing that happens is that they give him a work lap top. Naturally, he doesn’t want to add his personal data and configuration to his work machine. At the same time, he often needs to make personal notes and perform other non-work-related tasks during the day. The easiest answer is to carry two machines but who wants that? His solution is to install a virtual machine on his work laptop for his personal use.

He wanted a simple environment that mostly runs Emacs so he installed a server version of Ubuntu. He still wanted a graphical interface so he also installed xinit. The surprise is that the only thing he put in his .xinitrc file was

exec emacs

That effectively makes Emacs his window manager. He added a simple directive to his init.el to make Emacs open full screen so it was almost like booting into Emacs. Of course, he discovered he needed a few other applications but those turned out to be simple to add. Take a look at his post for the details.

Posted in General | Tagged | Leave a comment

REPL Driven Programming

I’ve written many times about what I call “exploratory” or “interactive” programming. The idea is you build your program from the bottom up, trying out expressions, building them into larger and larger units until you have a whole program. For me, the quintessential example of this is Kris Jenkins’ video on writing an Emacs Spotify client in 16 minutes. If you haven’t seen it or you’re the least bit confused about what I mean when I talk about exploratory programming, be sure to take a look. You won’t, I promise you, regret the 16 minutes you spend on it.

The other day, I saw a citation, I don’t remember where, for Mikel Evins’ post On repl-driven programming. By “REPL driven programming” he means what I call exploratory programming. His post was in response to someone asking how Python or Ruby REPLs are different from those in Lisp or Smalltalk and why Lisp’s and Smalltalk’s versions are better.

The TL;DR is that with Python, etc. you can do some things in the REPL but with Lisp and Smalltalk you can do everything. That means, in particular, that you can build and simultaneously debug your program right from the REPL as Jenkins demonstrates in his video. Notice that Jenkins never really “types in” his program. He just builds it up in the REPL1.

Evins’ discussion is mainly centered around Common Lisp and he goes on to describe how a run time error in Common Lisp drops you into “breakloop”, which is a parallel REPL in which the context of the running application is available. That means that you examine and fix the code and resume the computation where it left off. If you want to know what’s so great about the Lisp REPL, take a look.

Footnotes:

1

Jenkins isn’t technically using the REPL. He’s typing expressions into his buffer and then executing them with Ctrl+x Ctrl+e, which is essentially the same thing.

Posted in General | Tagged , | Leave a comment

Exporting Clock Tables

After watching Jake B’s video on Org Clock Tables and Irreal’s commentary on it, The Emacs Cat decided to share how he uses clock tables. His use is very idiosyncratic and fashioned for his specific circumstances. The TL;DR is that his employer not only requires a periodic report of time spent on various tasks but requires a very specific format for the report that must be delivered in MS Word.

Putting aside, for the moment, the indignity of having to use Word, the stumbling block to simply using the Clock Table output is that requirement for a specific format. All the necessary data is there but in the wrong format.

It turns out that Org has the org-clock-get-table-data function that gathers the data for the Clock Table report and delivers it as an easily parsable list. Part of his employer’s specific format is that dates must be of the form DD.MM.YYYY and the times must be zero padded on the left and have different lengths depending on the context. Once he had raw data, it was easy to format appropriately and produce the required report. That leaves only delivering it as a Word doc. Of course, once more Emacs has us covered and he simply exported his results as an ODT file.

The other nice thing is that he did his development right in his time tracking Org file using source blocks. He was able to experiment with various approaches and see the data that org-clock-get-table-data returned. It’s a really nice post and serves as a how-to for anyone who needs to produce custom time reports.

Posted in General | Tagged , | Leave a comment

Zamansky: Learning Elisp #5

Mike Zamansky is back with the fifth episode of his Learning Elisp Video series. I say “episode” rather than “video” because he’s split Learning Elisp #5 into two videos. That was to prevent a single, overly long video. As it is, the two videos run 14 minutes, 4 seconds and 12 minutes, 55 seconds.

The theme of the first video is conditional statements: if statements and the like. As Zamansky points out, the Elisp if statement is pretty much like the if statements of other languages but with a bit less syntactic sugar. You can, of course, chain these if statements as you do in other languages but Elisp has a better way: the cond statement that lets you test sequential conditions and perform the action associated with the first condition that returns t.

He uses the cond statement to expand his rot13 function to deal with capital letters and characters that aren’t a letter. At this point, he’s got a reasonable rot13 function.

The second video has two main themes. The first is how to make his rot13 function accessible from the Emacs “command line” (via Meta+x) and assign it to a key sequence short cut. This mainly involves the (interactive) declaration.

The second theme is applying rot13 to arbitrary text in the current buffer without actually typing the text in. He begins with showing how to apply it to the word at point and the entire line at point. No doubt he’ll expand on this in subsequent videos to provide a flexible rot13 like the built-in version.

At this point, his Learning Elisp series is beginning to show how to use Elisp to build useful functions for actual use in Emacs. If you’re new to Elisp, this is a very useful series to follow.

Posted in General | Tagged | Leave a comment

Scanning QR/Bar Codes with Emacs

If you’re like me, every once in a while you need to scan a QR code—or even a bar code. Not often but every once in a while. There are all kinds of apps to do that, especially on our phones but, of course, the true and faithful Emacser wants to do it from within Emacs. Álvaro Ramírez to the rescue.

You can probably guess that this is another functionality he’s folded into his dwim-shell-command framework. The secret sauce is the zbarimg utility, which is available on all three of the major platforms. Ramírez recommends macOS users simply download it from Homebrew. There are binaries for many systems at the Zbar GitHub site.

This is, as I say, not something that you’re going to use every day so it make sense to give it an easy-to-remember name as Ramírez does. Of course, that’s a lot easier if you have his dwim-shell-command framework installed. Doing so not only gives you an easy-to-remember name but also arranges for it to work seamlessly with dired.

Posted in General | Tagged | Leave a comment

Prot On Writing A Custom Mode Line

Protesilaos Stavrou (Prot) has a really interesting video on writing a custom mode line. If you’re like me, your mode line customizations are limited to adding the line and column indicators and using diminish to inhibit displaying various minor modes. You can, of course, do more but the details of making a custom mode line are surprisingly fussy.

Prot’s video shows us how to do it. He starts by showing us his custom mode line. It has some nice features. One thing I liked is that only the window with focus has the full mode line. The other windows have an abbreviated mode line showing only the buffer name and its major mode. That makes it easy to tell which window has focus so he doesn’t need to change the background as the default mode line does.

Prot has some idiosyncratic notions of what should be on the mode line—he doesn’t like the line and column indicators, for example—but that’s why, after all, you have custom mode lines. His video is not about how to reproduce his mode line; it’s about how to make your own.

As I said, the process can be a bit fussy and there are all kinds of gotchas but once you know a few rules it’s pretty easy to build your own. The nice thing is you can display your candidate mode line as you build it without having to restart Emacs.

As usual, Prot provides links to his own configuration so you can copy some or all of what he did. He also provides a copy of the intermediate code he used while developing his sample mode line so you don’t have worry about copying it down from the video. The runtime is 41 minutes 53 seconds so you’ll have to schedule some time but if you’ve ever wanted to customize your mode line, it will be well worth your time.

Posted in General | Tagged | Leave a comment

Emacs 29.1 Released

Eli Zaretskii writes to announce that Emacs 29.1 has been released and is available in the usual places. As usual, I compiled it from source so I don’t know if the prebuilt distributions have been released yet.

In any event, this post is being written with the new version so there are no obvious nasty surprises. As usual, many thanks to Zaretskii and everyone else who worked so hard to bring this new release to us. These guys are heroes who don’t get nearly enough recognition for what they do. If you run into any of them, be sure to buy them a beer.

Posted in General | Tagged | Leave a comment

Composing Avy

A couple of years ago Karthik Chikmagalur published a long, dense post on how Avy can do anything. For some reason—I no longer remember why—I never added his post to my blog queue. Recently his comment to my post Emacs Elements on Avy reacquainted me with his post and I’m astounded that I didn’t write about such a rich and useful post.

I’ve written many times about how Avy is one of my most-used commands. It makes it almost trivially easy to move around in the text on the screen. Avy has several commands—more than appear in the documentation. One of Karthik’s two main points is that there are too many commands to remember or bind so you should settle on just one and use it for everything. There’s some merit to that idea. He uses avy-goto-char-timer, which can, indeed, perform most of the tasks of the other commands. I use it everyday but my most used Avy command is avy-goto-word-1, which I like because it considers only letters beginning words and thus reduces the number of targets. As a practical matter, I restrict myself to those two Avy commands.

His second main point is that Avy is much more general and useful than you thought. After you select a target, the default action is to jump to that location but other actions are possible. There are several alternative actions, which you can see by typing ? when the list of targets appears.

But wait. There’s more. You can also easily add your own actions as Karthik demonstrates. His post shows several such actions with the code to achieve them. He also has a link to a file with all the code if you want to steal some or all of them.

This is a really good post and worth your time to read even though it is long. And, as I said in my Emacs Elements on Avy post, if you aren’t using Avy, you’re working too hard.

Posted in General | Tagged | Leave a comment