Emacs For Common Lisp

Susam has a very nice Githup repository that contains an Emacs configuration for working with Common Lisp. The nice thing is that the README contains a complete explanation of what the configuration is doing and has a line-by-line exegesis of it so that you can understand how it works and how to modify it to suite your individual needs.

I don’t use this configuration—having started with Common Lisp long before I saw it—but my configuration is almost identical to Susam’s. The main difference is that I don’t use rainbow delimiters. I’ve found that Paredit keeps track of parenthesis nesting for me but you may find rainbow delimiters useful.

Susam thinks of his configuration as being for Emacs/Common Lisp n00bs and therefore has some introductory material on using Emacs itself but even if you’re experienced with Emacs but not with Common Lisp, you will find it useful for getting started.

The main features of the distribution are:

  • Slime
  • Paredit
  • Rainbow Delimiters
  • Quicklisp

Some of these require a bit of configuring to invoke them for the appropriate modes so Susam’s configuration is a good place to start. You can, as I did, figure all this out for yourself but Susan’s configuration provides an easy starting point.

The README for the repository is fairly long but worth at least skimming through if you’re interested in setting up a Common Lisp development environment.

Posted in General | Tagged , , | Leave a comment

Media Progress

Dmitriy Pshonko has an interesting project for those of us who like to (a) stay in Emacs and (b) use the mpv media player. The idea is that you can list your media files with dired and it will tell you where you left off in the file if you started but did not complete it. Files that you’ve completed are marked done and the rest are simply listed.

I almost always consume these files in one sitting but sometimes I get interrupted and it would be nice to have a way of picking up where I left off. I don’t use mpv so I haven’t installed this package but if I did use mpv, I certainly would. It’s in MELPA so installation is simple and configuration consisted of setting a hook. The README explains how to do this directly or with use-package and is in any event a one liner.

If you’re an Emacs and mpv user, this package seems like a very nice addition.

Posted in General | Tagged | Leave a comment

Duplicating Dired Files

I ran across a post by James Dyer, Dired Duplicate Here Revisited, that was interesting and I thought was worth writing about but I wasn’t sure there was enough there for a post. Then I saw this post by Álvaro Ramírez and thought they complemented each other and together can serve as the basis for my own post.

It turns out that Ramírez had the same thought and that his post was inspired by Dyer’s. It started with Dyer wanted a quick way to duplicate a file in a Dired buffer. His workflow results in a frequent need to do this so it made sense to make it as frictionless as possible. His code to do this is simple and straightforward.

Ramírez, of course, extended the idea by including it in his dwim-shell-command framework. He uses Bozhidar Batsov’s crux-duplicate-current-line-or-region that duplicates a line or region. It’s similar to Joe Casadonte’s and Steve Purcell’s whole-line-or-region that I use. In any event, he leveraged his muscle memory for that by using it to invoke his dwim-shell-command template to duplicate one or more files in a Dired buffer.

If you also have a need to duplicate one or more files in a Dired listing, take a look at these two posts. They present two excellent solutions.

Posted in General | Tagged | Leave a comment

Emacs Defaults

Charles Choi has another thought provoking post: this time it’s about Emacs defaults. He begins by noting that Emacs exemplifies the idea that you should separate policy and mechanism by providing a mechanism but leaving the actual policy to the end user. Put another way, Emacs allows the user to determine how certain functions will behave. That’s tremendously powerful and liberating.

The problem, he says, is the default policies. For any given action—whether or not it’s configurable—Emacs has to something and that something is the default policy. Choi’s complaint is that the default very often violates the principal of least surprise. I’d screw down on that by saying it violates the principal of least surprise for today’s users. Things like the CUA conventions are what new users might expect but not what long term Emacs users expect. The right thing for new users is probably to enable the CUA bindings by default but that would confound and anger long term users. My point is that it’s not as easy as doing “what people expect”.

The majority of Choi’s post is devoted to default choices with which he disagrees. Most are hard to argue with. There’s no reason, for example, why bookmarks shouldn’t be saved immediately rather than risking them in an Emacs crash.

Some, such as the number of spaces ending a sentence are not as straightforward as he and others imagine. Yes, we are no longer using typewriters and the original rationale for using two spaces no longer applies but, again, old time users may expect the two space rule. Even those who’ve never used a typewriter can make a coherent case for it: it’s easier to write scripts and distinguish end of sentences from things like “Mr. Jones” if sentences end in two spaces. This is a raging question even outside the Emacs community.

In others, such as Magit prompting you if you have an unsaved buffer that might effect the current operation, I think he’s just plain wrong. Almost every time I see that prompt it’s because I have, in fact, neglected to save a buffer. Of course, we all have different work flows so you may disagree.

Finally, his suggested defaults includes some useful things that I didn’t know about. For example, I run Emacs in full screen, which means that when I run Ediff the control panel is not visible. Choi explains how to fix this. similarly, when you invoke Man, the focus stays in the current buffer making it hard to negotiate the man buffer. Again, this is configurable and it seems to me to make more sense to do as Choi recommends.

It’s a good post and you may even learn something useful like I did.

Posted in General | Tagged | Leave a comment

Zamansky Elisp Video #1

The first video in Mike Zamansky’s promised series on Elisp has dropped. This video serves as an introduction to the series. It mostly positions Emacs as a Lisp interpreter that comes with an editor. Or as Irreal is fond of saying, a recapitulation of the original Lisp Machines. Emacs is not really a Lisp Machine, of course, but I’ve found that it helps my understanding of it to think of it that way.

Zamansky’s central point is that everything you do in Emacs amounts to running one of it’s commands. The obligatory example is what happens when you type a character into a buffer. That results in the command self-insert-command being run. Zamansky shows how you can run any s-expression in a buffer by putting the cursor at the end of it and running eval-last-sexp (bound to Ctrl+x Ctrl+e) and uses that to open a file and to change to another buffer.

Zamansky takes the material slow and easy. Even though he described it as just a short introduction to the series, the video ran 19 minutes, 49 seconds so he’s making sure to cover each point carefully and illustrate it with examples. Obviously, at almost 20 minutes, you’re going to have to schedule some time but as with all of Zamansky’s videos, it’s time well spent.

Posted in General | Leave a comment

A Nice Dark Theme

The Minions aren’t going to like me saying this but I’ve stumbled upon a nice and actually legible dark theme. idlip Dilip has a new, high-contrast theme, Haki, that started with Prot’s modus-vivendi and some of Daniel Mendler’s packages to design a theme that was perfect for him.

Take a look at his screenshots to see what it looks like in a number of Emacs modes. Notice how everything is legible. There is no dark blue on black or other unreadable hideousness. Just sharp, high-contrast colors. And I love the irony of the top post in his Elfeed screen being Irreal’s Red Meat Friday: Dark R Sessions in ESS.

Even though it’s relatively new, Haki is already available in MELPA. The README has installation instructions and a use-package recipe. I will not, of course, be abandoning my light mode non-theme but if you’re in the intersection of people who (1) like dark themes and (2) like being able to read the text in the buffer you should definitely take a look.

Posted in General | Tagged | Leave a comment

The Eshell Manual

As many of you know, I’m a big fan of Eshell and use it was my main shell. The traditional gripe about it has always been that there’s no manual. John Wiegley, who wrote Eshell, offered to write a manual if someone would pay for it but, apparently, no one stepped up so for many years there was no manual.

I’ve been dimly aware of a project to write such a manual and, indeed, there’s an early version in my Emacs 28.2 build. Jim Porter writes that he has merged what he hopes is the final version of the manual and is asking that anyone interested take a look at it and let him know if you find any gaps or bugs. He’s added a lot of material since the last release so it’s definitely worth a look if you’re an Eshell user.

There’s a lot of power in Eshell but without a manual, it’s always been hard to discover. Mostly you had to read blog posts or videos by those who are familiar with the source code. Now that there’s a complete manual, it’s probably worthwhile reading through it to discover all that it’s capable of.

Most developers don’t enjoy writing documentation so we owe Porter a special debt of gratitude for picking up the project and seeing it through.

Posted in General | Tagged | Leave a comment

Marks, Bookmarks, and Registers

Protesilaos Stavrou (Prot) has another great video out. This one is about marks, bookmarks, and registers. You can probably guess from the title that the video is mainly about ways of moving around in a file or files efficiently.

He starts by making the obvious but often overlooked point (heh!) that the mark is really the last place the point (or cursor) was. That’s not literally true, of course. If you move the cursor left or right or up and down a line, you won’t affect the mark but any “big” movement sets the mark to where the point was before the movement.

He moves on to the usual marking of regions but along the way he does an excellent job in explaining the use and value of Ctrl+x Ctrl+x. In the past, I hardly ever used it because I didn’t understand its use cases very well. After watching this video I’ll definitely be using it more often. While discussing marks, he also describes how to use them to remember locations.

Then he moves on to remembering locations by storing them in registers. It’s a more deliberate way of remembering a location than by storing a mark. When you want to jump to a location stored in a register, you’re given a nice list of the registers to help you remember which register is storing your desired destination.

Finally, Prot considers bookmarks. They’re sort of like storing a location in a register but they’re persistent. As with registers, you get a listing of the available bookmarks when you’re ready to visit one.

Prot ends the video with a bit of configuration that you may find useful. The video is 35 minutes, 33 seconds long you’ll have to schedule some time but it’s well worth your time. Even if you’re an experienced Emacs user, you may learn a few new things.

Posted in General | Tagged | Leave a comment

Tramp Video

Over at Skybert Hacks, Torstein Johansen has a nice video on using Emacs tramp. Although it does sometimes get bad press, Tramp is a gem and a definitely underappreciated feature of Emacs. It also can seem hard to learn—especially when using an intermediate host—but as the video shows there’s only one thing invocation to know.

For me, the hard part was going through an intermediate host. It was never as easy as it was supposed to be and only Phil seemed to have a handle on it. But Johansen has a nice way of approaching it. Instead of relying on the Emacs invocation, it does some SSH configuration magic. Once that’s done, you simply invoke tramp in the normal way and SSH takes care of the intermediate host.

This is a really nice video even if you’re already familiar with Tramp and it’s well worth a few minutes of your time. The video itself is only 8 minutes 16 seconds so you should be able to fit it in easily.

Posted in General | Tagged | Leave a comment

Vanilla Emacs Configuration

Emacs Elements has another useful video on a minimal configuration for vanilla Emacs. This is mainly for the new user, of course, but I was struck by how closely it matched my basic configuration. My current init.el is about 2,500 lines so there’s obviously a lot more there but I think the video captures what a new user needs to get started with Emacs.

The video starts out by getting rid of all the annoying things that everyone wants gone. That includes the startup screen, the tool bar, and the menu. I’d add the scroll bar to that but others may disagree. Note that deleting the menu bar on macOS can be problematic and you may want to omit that change if you’re on macOS.

Next up is configuring the package system. Part of that was arranging to include the use-package package. Fortunately, after Emacs 29 that will no longer be necessary because it will be included automatically. The other part of package configuration that everyone will want to include is adding MELPA as one of the package repositories. That will never be included out-of-the-box because of ideological reasons so it’s needs to be done manually. Most of the useful packages are available only there so including it is pretty much mandatory no matter what the true believers tell you.

The video includes some other useful configurations so you should definitely take a look if you’re interested in a minimal Emacs configuration. The video is only 8 minutes, 36 seconds so it should be easy to fit it in

Posted in General | Tagged | Leave a comment