Embark For CIDER & Projectile

Bozhidar Batsov, who’s been writing about Embark lately has a nice post on integrating CIDER and Projectile into Embark. I don’t use either of them so you might wonder why I care. The answer is that Batsov’s post is a good example of how to add a new application to Embark.

That turns out to be pretty easy. For projectile, Batsov built it into the app so you’ll have to check the source code to see the details. For CIDER, though, he adds the Embark functionality externally so you can see how it’s done. It’s mainly a matter of writing some straightforward wrapper functions, binding them up in a keymap for Embark, providing a target function that identifies symbols, and finally adding the keymap to Embark.

For me, then, the value of Batsov’s post is that it serves as a how to that shows you the recipe for extending Embark to include new applications.

Posted in General | Tagged | Leave a comment

Copy Link At Point In EWW

Raymond Zeitler over at Ray on Emacs has a nice post on copying the link at point in EWW. It’s sort of hidden so that’s the reason for his post and this one. He decided to write his own because he couldn’t find anything that already did the job. It was only after he wrote it that he stumbled on the existing functionality.

The short answer is that the u key does just what he wanted. The longer answer is that sometimes w also works. The documentation says that w copies the URL of the current page but if the point is on a link, it will copy the link’s URL instead.

I’m finding that I’m using EWW more and more so I’m glad to have this information. Zeitler has more details so be sure to take a look at his post.

Posted in General | Tagged | Leave a comment

A Couple Of Tips For Emacs on macOS

Over at The Art Of Not Asking Why, JTR has begun a series on his Emacs configuration. This post covers his special arrangements for macOS. There are two tips, in particular, that seem to come up all the time.

The first is setting the path. That, of course, is supposed to be a simple process on Unix-like systems but doesn’t work correctly for Emacs on macOS. A long time ago, Steve Purcell solved this problem with his exec-path-from-shell package. You can read the details and what the exact problem is at the package’s GitHub repository. If you’re using Emacs on a Mac, you definitely need this package.

The second problem involves Dired. It’s obvious, if you think about it, that Dired depends on the Unix ‘ls’ command to produce its listings and some of its other operations. The problem is that the macOS version of ls is missing some of the options that Dired needs. The solution is to use the GNU version of ls, called gls. That’s easy to do but you first have to install it. The easy way to do that is through Homebrew. Once gls is installed, you need merely tell Dired to use it.

All the details for solving these two problems are in JTR’s post so if you’re running on macOS, you should definitely take a look at it. I’ve had both those changes installed for as long as I can remember but I do recall struggling with these issues until I found the solutions. Happily, if you’re new to Emacs on the Mac, JTR has both solutions for you in one place.

Posted in General | Tagged , | Leave a comment

Emacs 31.0.91 (pretest 2) Is Available

Sean Whitton writes to say that Emacs 31.0.91, the second Emacs 31 pretest, is now available. If you’re interested in trying it out, you can get a copy from https://alpha.gnu.org/gnu/emacs/pretest/emacs-31.0.91.tar.xz. It’s signed so you should also get the signature file from https://alpha.gnu.org/gnu/emacs/pretest/emacs-31.0.91.tar.xz.sig.

This is good news, of course, because it means that Emacs 31 is that much closer to release. There’s some great new features coming in Emacs 31 (see the NEWS file for details) so I’m looking forward to its release. On the other hand, it’s good that the devs are being conservative and trying to wring all the bugs out before the official release.

If you don’t mind living (slightly) on the edge, try it out and let the devs know if you find any problems.

Posted in General | Tagged | Leave a comment

Making A Window Dedicated

Bozhidar Batsov has been a writing a very nice series of posts on recent Emacs additions that are worth knowing. His latest is on making a window dedicated. A dedicated window is one that is locked to its current buffer. That means, for instance, that if you have a particular window configuration in place and call some other function, the new function can’t hijack the dedicated window and spoil your configuration. Batsov has an animated Gif that shows this in action.

The notion of a dedicated window has been in Emacs for some time but what’s new is a quick way of dedicating a window. That way is toggle-window-dedicated, which is bound to Ctrl+x w d by default. As shown in Batsov’s Gif, that toggles the dedicated state for the current window on and off.

Sadly, I have Ctrl+x w bound to a function that starts up elfeed. I use that several times a day and have a significant investment in muscle memory so I either have to change the toggle-window-dedicated binding or simply call it directly. Since I doubt I’ll be using it that often, I’ll probably just call it directly. With my fuzzy command completion I need only enter Meta+x tog win to get the desired result.

There’s one other aspect that Batsov mentions but doesn’t explain: strongly dedicated windows. If a window is strongly dedicated, you can’t change the buffer displayed by the window. You can make a window strongly dedicated by specifying the universal argument in the call to toggle-window-dedicated.

If you like to set up a specific window configuration for some of your workflows and you don’t like random commands stepping on it, toggle-window-dedicated is just what you need.

Posted in General | Tagged | Leave a comment

Aligning Mode Line Elements

Mode lines. Everybody complains about them and a few brave souls—like Prot—have even taken the time and effort to do something about them. The problem is that they’re so tricky to configure that it’s not worthwhile so we just suffer with the default.

Now Bozhidar Batsov writes about an easy change that anyone can make. As of Emacs 30, it’s possible to right align given elements of the mode line. That was always possible, of course, but it required some tricky padding that was particularly fragile. Now there’s mode-line-format-right-align, which serves as a marker in your mode line definition. Everything before it is left aligned and everything after it is right aligned.

Even the right edge is customizable. You can choose the right edge of the window, the left end of the fringe, or the left edge of the right margin. This facility is going to be useful to those who want a customized mode line.

My main problem with the mode line is getting all the items I want to fit on it. Even though I make liberal use of diminish, a lot of useful information always seems to fall off the right end. That probably means I need to watch Prot’s video again and buckle down to customizing it the way I want it.

In any event, it you’d like to place some items at the right side of the mode line, take a look at Batsov’s post to see how to do it.

Posted in General | Tagged | Leave a comment

Flymake Diagnostics

Bozhidar Batsov has a quick post on a recent enhancement to Emacs Flymake. The TL;DR is that you can arrange for Flymake to append a diagnostic at the end of any line with a problem. It’s a quick way of seeing what the problem is and maybe fixing it without a lot of extra work.

As Batsov (and the documentation) says, that can get a little noisy so (of course) Emacs gives you a setting to control how much information is displayed. Take a look at Batsov’s post for the details.

I’ve never warmed up to Flymake but lots of people, I know, love it. If you’re one of those people, be sure to take a look at Batsov’s post. Everything is controlled by a single variable so it’s easy to try out the various options.

This feature is available only with Emacs 30 and later. Getting it may be a good reason to upgrade if you haven’t already.

Posted in General | Tagged | Leave a comment

A Small Jinx Tweak

As I’ve written recently [1, 2, 3, 4], I’ve been changing the Irreal Bunker’s spelling corrector to Jinx. I’ve had a couple of issues—mostly with choosing the correction—but things have mostly been smooth and Jinx has a lot of nice features.

One thing I don’t like is the face that Jinx chooses for misspelled words. Ispell used red, which stood out and made it easy to pick out the misspellings. Jinx uses a color that is almost the same as the text and even though misspellings are underlined with a wavy line they’re harder to pick out. There are two colors: one for dark themes and one for light themes. Oddly, there are no options for changing the colors.

Happily, this is Emacs so the source code is only a click away. It turns out the color is defined by a defface in the jinx.el file. I copied that to my init.el and changed the color to red Here’s the result:

(defface jinx-misspelled
  '((((class color) (min-colors 88) (background dark)
      (supports :underline (:style wave)))
     :underline (:style wave :color "#d2b580"))
    (((class color) (min-colors 88) (background light)
      (supports :underline (:style wave)))
     :underline (:style wave :color "#ff0000")) ; <-- changed color
    (t :underline t :inherit error))
  "Face used for misspelled words.")

I was going to change the color for the dark theme too just for completeness but the Minions wouldn’t allow it. You know how they are about dark themes. If you want to change the color in your Emacs, just paste the above into your init.el and choose whichever color works for you. You can, of course, also fix things up for dark themes. Just don’t tell the Minions.

Posted in General | Tagged | Leave a comment

Reading

Elia Scotto has a very nice post on the reading habit. He says he’s been reading about a book a week for several years. The gist of the post is “how to read more books”. His advice for that is straightforward: read when you have nothing else going on. In particular, instead of reaching for your phone and doom scrolling, pick up a book and read a few pages. I agree with all that but not with some of his other recommendations that seem to me to border on the new Luddism.

For example, he considers it important to avoid using your phone. That means he wears an analog watch (so he won’t have to look at his phone), that he tries to carry a physical book with him at all times, and that when he can’t he uses a separate ebook reader.

I also read when I have a few spare moments but I do it on my phone. My iPhone is always with me so I don’t need to remember to bring along a physical book or separate reader. It’s all there on my iPhone. I always read for about an hour when I go to bed and for that I use my iPad. If during the day I find myself with nothing to do, I can always sync my phone to where I left off on the iPad and continue my reading.

Really, I don’t know why anyone wouldn’t do things more or less the way I do. You always have not only your current book but your entire library at hand. But then, I’ve never found doom scrolling—or social media, for that matter—attractive so I have nothing to resist.

In any event, the important thing is to find time to read. You don’t have to be an intellectual or read big, important books. Although I sometimes read books like that, I mostly read mysteries and science fiction. Some of them are as lowbrow as you can get. It doesn’t matter. The goal is to read and enjoy the content.

Finally, be sure to watch the short video of the late Umberto Eco’s library of about 30,000 physical books. Despite what I said above, I love physical books and found it awe inspiring.

Posted in General | Leave a comment

Embark

Some time ago, I installed Embark but I never got around to learning it and it has sat unused ever since. Then I saw this post by Bozhidar Batsov and decided to take another look. The problem with Embark is that it’s hard to understand and the documentation is long and complex. Too long, I discovered, to read and understand in one sitting.

I approached the problem by reading a section at a time and trying out examples in my Emacs. Even so, it still took some experimentation to completely figure things out. The process is ongoing but I’m making progress.

All of the above sounds pretty negative but I actually think Embark is a real win. Once you figure things out it’s really useful. For example, one of the things I’ve never been able to get working reliably is following a link in an arbitrary buffer to its target. Embark does that easily and if you use embark-dwim it’s a single keystroke. I use Hyper+. for embark-act and Hyper+, for embark-dwim. I have Hyper bound to the right ⌘ Cmd key so it’s very easy to invoke either of those commands.

Batsov is all in on Embark. He and I often share preferences and this is an example of that. The more I find out about Embark, the more I like it. The commands that work on a group of files can be difficult to grok but once you do they’re very powerful. I’ve resigned myself that learning Embark is an ongoing process but I think it’s worth it.

Posted in General | Tagged | Leave a comment