Writing Prose In Emacs

Charles Choi has another great post; this time it’s on Tuning Emacs to Write Prose in Org and Markdown. The post is about how he configures Emacs for writing prose. I agree with roughly half his suggestions but this is a matter of taste and neither his nor my preferences are correct. They’re merely preferences and you should choose whatever works best for you.

His first suggestion is to use proportional fonts for prose. It’s easier, he says, to read and makes writing less distracting. I write all my posts and other prose in fixed width fonts but I’m willing to be convinced. It’s easy to add a binding to toggle a buffer between fixed and proportional fonts and I’ve done that so I can try writing with proportional fonts. You need merely toggle variable-pitch-mode to try this out for yourself. If you don’t like it, just toggle it back. If you become a convert add a hook as Choi recommends. I’m writing this post with variable-pitch-mode toggled on to see how I like it.

His second suggestion is to hide markup (things like surrounding text with stars to make it bold). I disagree with this. To me it seems to hide information. Of course I’ve been using one markup or another for over a quarter of a century so perhaps I’m just used to seeing it. Regardless, Emacs let’s you have it either way.

His next suggestion is to use flyspell, which I completely agree with. I was a bit confused by his suggestion to use company-mode to suggest alternate spellings. That’s built in for me and bound to Ctrl+;. Perhaps that’s because I use aspell rather than osx-dictionary.

Next he suggests using dabbrev-expand to complete the current word based on previous words in the buffer. I do this too but use hippie-expand, which basically tries to complete the word in all possible ways.

Choi suggests leveraging the menu system for various operations. I strongly disagree with this. One of my goals is to eliminate mouse actions completely. That’s easy in Emacs but recently I’ve been experimenting with ways to eliminate its use in the rest of my macOS interactions. I’ll write more about that later.

Finally, Choi suggest using visual-line-mode and some sort of word counting facility. I started using visual-line-mode to avoid hard line wraps in WordPress but like it and have started using it for all my (prose) writing. For line counting, I use the excellent wc-mode to give me a running count of words.

Choi also strongly suggests using Avy. Long time Irreal readers know that I’m completely on board with that.

This is a good post with lots of good ideas. You may agree or disagree with a particular suggestion but Choi is upfront with admitting these are his preferences and yours my differ. If you use Emacs for writing things other than code, you’ll want to check out this post.

Posted in General | Tagged , | Leave a comment

The Emacs Mark

I just stumbled across an Emacs Elements video from 9 months ago. It’s about the Emacs mark and how to use it. There are lots of videos about this and Irreal has commented on some of them but it’s one of those subjects that I, at least, have a hard time internalizing so it bears repeating for some of us.

One nice feature of the video is the use of visible-mark to display the placement of the two most recent marks. That helps a bit with the exposition.

The video starts with ways to set the mark and exchange it with the point. Most Emacsers know the basics of that but may not know that you can set an inactivated mark with Ctrl+Space Ctrl+Space. That’s useful if you want to set the mark but not specify a region.

Similary, Ctrl+x Ctrl+x activates the mark when it’s swapped with the point so the region between them is highlighted. If you don’t want that, simple specify Ctrl+u Ctrl+x Ctrl+x instead.

Next, the video considers ways to mark various objects: word, sentence, paragraph, buffer, function, s-expression, or page. These are useful for deleting, copying, or moving text.

Finally, the video considers ways of using the mark for navigation. You can set the mark at a particular location and return to it later by popping the mark with Ctrl+u Ctrl+Space. This is made more useful by the fact that Emacs sets the mark automatically for many large movement commands.

The video is 13 minutes, 26 seconds so you’ll need to schedule some time but not too much. If you’re like me and have a hard time internalizing these commands, it’s worth your time to watch it.

Posted in General | Tagged | Leave a comment

Plainorg Pricing

I’ve written about Álvaro Ramírez and his Emacs projects many times. He’s produced some impressive Emacs apps that many of us take advantage of. Like me, Ramírez is an Apple user and he has also written some iOS apps that that are similarly worthwhile. One of those is his wonderful *scratch* app that provides a sort of Emacs *scratch* buffer on an iOS device. My first thought was “why would I want this?” but I bought it on a whim and shortly thereafter life intervened to validate my choice. I’ve been a fan ever since.

Ramírez also has an iOS app, plainorg, that provides some elementary interaction with Emacs Org files. I haven’t installed it mostly out of inertia and dithering about whether I should choose it or one of the other iOS apps that offers to bring Org to my iPhone. Despite my indecision, plainrorg has been well received and users—in the way of users everywhere—are demanding new features.

That, of course, requires significant effort and Ramírez is wondering the what’s the best way to pay for that effort. Take a look at his reddit post to get an idea on what he sees as possible solutions. He considers a single one-time fee, a subscription plan, and several other ways.

In general, I prefer to pay for a lifetime license up front even if the cost is larger than a few years of a subscription. One commenter suggests a hybrid scheme where you can either subscribe or pay up front once and for all. One thing I don’t like is a one-time fee that devolves into a subscription plan. I view that as a bate and switch scheme and it always puts me off. Several of my important apps have done this and it always annoys me and starts me looking for alternatives.

In any event, if you fall into the intersection of Emacs and iOS users, vote in Ramírez’s poll to help him decide what to do.

Posted in General | Tagged , | Leave a comment

Emacs Text Sorting

Susam Pal has an excellent post on sorting text in Emacs. Most experienced Emacers have probably seen most of the methods he talks about but unless you use them all the time, it’s easy to forget them. This post is a nice reminder and a useful summary that’s worth saving for future reference.

He starts with the simplest case of merely doing an alphabetical sort of the lines in a region with the sort-lines command. Specifying the universal argument does a reverse sort. This single covers a lot of the cases you actually run across but, of course, there’s more.

If your data is vaguely table-like, you may want to sort the lines based on a particular column. The sort-fields command handles this case for alphabetical columns and the related sort-numeric-fields take care of the case where the data in the column is numeric. That makes sure that 20 sorts before 100. In all these cases, it’s probably easier to call reverse-region after a normal sort if you want a reverse sort.

Next, he considers sorting on multiple adjacent columns with sort-columns. In this case, it make sense to specify the universal argument if you want a reverse sort. From there he moves on to the slightly more general case of using a regular expression to specify the sort key with sort-regexp-fields. There are snares for the unwary with this command so be sure to read his two examples carefully.

Finally, he shows how to export the region to an external sort routine. If you’re familiar with the Unix sort command this can sometimes be easier than trying to remember the specific Emacs commands.

As I say, this is a really nice post and well worth your attention.

Posted in General | Tagged | Leave a comment

Mickey On What’s New In Emacs 29.1

Many—probably most—of you have upgraded to Emacs 29.1 by now. If you’re like me you have a basic idea of what’s changed but don’t wait to read the NEWS file before installing the update. Who can blame us? It’s long and detailed and much of it concerns things we don’t use and know nothing about.

My usual procedure is to install the update and then read Mickey’s article on what’s new. The odd thing is that the article, which he publishes for every major update, is always just an exegesis of the NEWS file but his commentary and helpful explanation of what some of the more esoteric changes mean makes reading it easier and less onerous than reading the plain NEWS file.

Even so, I find it hard to read through the whole thing it just one sitting. There’s just so much to absorb. None-the-less it’s very worthwhile taking the time to read it. If you’re like me, much of it won’t affect you much but buried in all those changes are some items that will very much affect you and that you definitely will want to know about. Often they’re small changes that you might not read about in the technical press or other online commentary but that are important to your workflow. If you don’t spend the effort to read through the NEWS file, you might never learn about them. Fortunately, Mickey’s articles make it a bit easier to do that.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Learning The Emacs Way

It’s easy to be annoyed at N00bs who complain that it’s sooo hard to configure Emacs into a state useful for working with X. Sometimes, a new user will, like domsch1988, try and fail repeatedly to bend Emacs into a useful tool for their workflow. Domsch1988, to his credit, kept at it and finally succeeded. The secret, he says, is to accept Emacs for what it is and not try to make it into whatever editor you’re used to.

Domsch1988 finally realized this after several attempt to use Emacs. He tried Spacemacs, he tried Doom, and he tried vanilla Emacs but it just wouldn’t take. Finally, he realized that the problem was that he was trying to make Emacs into VSCode or Neovim rather than embrace the Emacs way of doing things. Once he accepted that, he started with a plain Emacs and only added packages when he needed a missing functionality. No more explorer sidebar just because VSCode has one. He discovered that projectile-find-file was enough and had the benefit of not wasting screen real estate.

His main problem was that Magit was slow but that was because he was on Windows, which for various reasons explained in the comments makes Magit slow. A couple of commenters noted that the built-in VC subsystem is fast on Windows and a good alternative.

Domsch1988 showed that a lot of the complaints about Emacs being hard to use really boils down to trying the keep the habits from previous editors, not Emacs. It’s a good post and worth a couple of minutes to read.

Posted in General | Tagged , | Leave a comment

Sqlite Mode

There was a time when I had a rudimentary proficiency with SQL. I could make updates and rudimentary queries but those days are gone. I haven’t had the need to interact with an SQL database for several years so what facility I had with them has evaporated.

Fortunately, as always, Emacs has my back. The new Emacs 29 has a builtin sqlite mode that can read SQLite databases, list the tables, the rows of a given table, and even delete a row of one of those tables. Álvaro Ramírez has a short post that demonstrates these elementary facilities.

Of course, being Ramírez, he decided to extend those facilities. His changes, for the time being, are fairly minimal. He added the ability to tab (forward and backward) through the fields and the ability to edit the row fields themselves. A second post demonstrates these new abilities. The code, Ramírez says, is still a little hacky but seems to work well.

Sqlite mode, especially with Ramírez’s additions is perfect for someone like me who’s rusty on the mechanics of dealing with SQL databases. It doesn’t, of course, replace a thorough knowledge of SQL but it does give us SQL duffers the ability to perform elementary operations on an SQLite database.

Given that more and more applications—including Emacs—are integrating SQLite, this is a boon for those of us who like to live in Emacs. Take a look at Ramírez’s videos to see what’s possible.

Posted in General | Tagged | Leave a comment

An Example of Mode Line Customization

The other day I wrote about Protesilaos Stavrou’s video on customization the Emacs mode line. James Dyer saw the video too was inspired to make his own customizations. There’s nothing unusual about that, of course, but I was struck by how easy it was for him to build his own minimal mode line.

Dyer has distilled the complicated information from Prot’s video into a sort of minimal effective use case. His mode line is very simple and shows the buffer name only for the active window. I’m not sure why you’d want that but it nicely illustrates the method Prot uses to eliminate nonessential information for windows without focus.

If you’re interested in customizing your mode line, Dyer’s post serves as an excellent go-by. You can start with his code and tweak it until you have something that works for you. If you liked Prot’s video but were putting off doing your own customization because it seemed too complicated, take a look at Dyer’s post. It may help you get going.

Posted in General | Tagged | Leave a comment

Zamansky: Learning Elisp #6

Mike Zamansky has posted the 6th episode of his Learning Elisp video series. Again, he has split the content into two videos (9 minutes, 4 seconds and 11 minutes, 22 seconds) so as not to have a single overly long video. The subject is the conclusion of his discussion of implementing a Rot13 function.

The first video discusses the use of the interactive declaration to provide an optional argument for a function. He uses it to introduce an (optional) argument for the amount to rotate the text. He shows how to test if the argument was specified and to use the default of 13 otherwise.

The interactive declaration’s interaction with optional arguments is surprisingly rich. You can specify all sort of expected inputs such as numbers, symbols, directories, strings, file names, and many other possibilities. Zamansky mentions of few of these before settling on the appropriate choice.

He wants, of course, to input a number but for various reasons that he explains, he settles on the P. I have a small quibble with this part of the video. Zamansky says that Ctrl and a single digit will set the argument to 0-9, while Meta and any number of digits will set the argument to whatever number you input. On my system, Ctrl and Meta both support the any number of digits: indeed, they both call digit-argument. As far as I can see, there’s nothing special in my init=el mandating this behavior so you may want to check what happens on your system.

In the second video, he extends rot13 to support rotating regions. The main thing here is to detect if a region is active. Zamansky does this by checking if the mark is active. That’s okay but the recommended way is to use use-region-p, which checks the mark but also makes sure transient-mark-mode is set and checks for a few edge cases.

Similarly, he use (mark) and (point) to delimit the beginning and end of the region. The better way is to use (region-beginning) and (region-end) because, for example, (region-beginning) will use the lesser of the values of the mark and point and similarly for (region-end).

The choice of Rot13 was a good one because its (incremental) definition demonstrates several important aspects of Elisp and its run time library. After these 6 episodes, the Elisp n00b should be in a position to start experimenting productively with Elisp.

Posted in General | Tagged | Leave a comment

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