Another Mode Line Implementation

After watching and writing about Prot’s video on custom mode lines I’ve been experiencing a vague urge to customize my own. Adding to that urge has been a couple of posts by James Dyer who has also felt the urge. The first used Prot’s post as a jumping off point for his own customization. Now Dyer is back with his latest iteration.

Dyer has a list of goals for his ideal mode line. The ones that resonate with me are:

  • Show the full path name. I often wish for this, not for the same reason as Dyer but because I occasionally start a post in ~/org/ rather than ~/org/blog/ and having the full path name would help me realize this earlier.
  • A Clear indication of file modification. That’s not usually a problem for me but the three side-by-side indicators can be confusing if one other than the modified indicator is lit.
  • Efficient information display. Unlike Prot, Dyer and I like to have as much information as possible displayed. We both want the row and column of the point displayed, and would like at least the important minor modes indicated.

Dyer includes the code for his mode line configuration. To really understand it you should watch Prot’s video. Perhaps you, too, will feel the urge for a bit of mode line customization.

UPDATE [2023-09-11 Mon 11:41]: Added link to second Dyer post.

Posted in General | Tagged | Leave a comment

More Sqlite-mode Extensions

Álvaro Ramírez has extended his extensions to the Emacs 29 Sqlite mode. I no longer have to interact with SQL databases for work but these days seemingly every application uses an sqlite database. Why not? Sqlite databases don’t require a heavy weight database. They’re just local files accessed with a simple, robust library that allows the access and modification of the database with the SQL language.

Emacs 29 has an sql-mode that allows minimal interaction with an sqlite database. Ramírez has extended those capabilities in a useful way. Take a look at his post and animated gifs to see what you can do.

He says that the code is still experimental but if you need to work with sqlite databases, it may be just what you need. The code is available on GitHub and is a single relatively short file so it would be easy to added it to your configuration and try it out. If you need to interact with sqlite databases, you should definitely take a look at Ramírez’s post.

Posted in General | Tagged | Leave a comment

Elisp One Sexp At A Time

Some of the Irreal posts that make me the happiest are those that reveal a single tip that helps readers improve their workflow. Tony Aldon has an ongoing video project that presents a single piece of Elisp that performs some useful task. These are really useful and worth checking out to see if you learn something new. Mostly, they’re about 2 minutes long so it’s easy to fit one of them in with your morning coffee. So far, he’s been doing one a day.

The list of videos so far is:

  • How to match 47 characters in a string with Emacs Lisp
  • How to put the value of an Org property in the kill-ring with Emacs Lisp
  • Do you know how to generate html strings with Emacs Lisp
  • How to add html attributes with the Emacs package Jack
  • How to check for a regexp match after point with Emacs Lisp
  • How to insert foo at the end of buffer without changing point with Emacs Lisp
  • How to check for the states of buffer-local variables in Emacs Lisp
  • How to turn a function into a command in Emacs Lisp
  • How to insert strings in a given buffer in Emacs Lisp
  • How to list files in a given directory in Emacs Lisp
  • How to replace regexp in buffers in Emacs Lisp
  • How to search for regexp in buffers in Emacs Lisp
  • What influence does case-fold-search have on searches in Emacs Lisp
  • How to manipulate the match data in Emacs Lisp
  • How to replace regexp in buffers in Emacs Lisp

These are really useful and a nice way to learn some Elisp. They serve as an excellent adjunct to Mike Zamansky’s series on Learning Elisp.

Posted in General | Tagged | Leave a comment

Task Management With Org Agenda

Denis Kyashif has a nice post on how he uses the Org mode agenda to handle his task management. He has two main requirements:

  1. It should be easy to add tasks to his task list.
  2. It should be easy to read his task list and figure out what to do next.

He said that it took him a while to find a task management system that met those needs but like many of us, he settled on Emacs and Org mode.

The salient feature of Kyashif’s Org work flow is that the Org configuration is pretty much out of the box. He doesn’t have a lot a special configurations or special functions. He just uses Org and Org agenda in its default mode. It’s a nice example of how powerful and useful Org mode is for task management.

The real structure on his workflow comes not from Org or its configuration but from his self imposed restraints. He says, for example, that not everything needs to be on the task list. He keeps everything in a single file with each “project” having a top level heading. He tags those so that each sub heading will inherit it making search for the project tasks easy.

It’s a nice workflow and his post is worth reading if you’re searching for your own task management system.

Posted in General | Tagged , | Leave a comment

Compiler Humor

Apropos of Nothing, as Cheryl Crow once put it, here’s something you don’t see very often: compiler humor. From another era when engineers were still allowed to inject whimsy into software, Tony Cunningham offers us a selection of error messages from Apple’s MPW C compiler. Take a look. Some of them are hilarious; they’re all amusing.

You don’t see this anymore, of course. The suits came along and insisted that such things weren’t “professional” and trivialized the very important products that they were trying to sell to other humorless drones.

There’s a long tradition of this sort humor, especially in the Unix world. There’s the famous “bug” listed at the end of the tunefs man page: You can tune a file system, but you can’t tunafish. That joke was in the BSD Unix distribution until the suits discovered it and had it removed. Then there was the in-joke values of β will give rise to dom! error diagnostic from the Version 6 mv utility. Dennis Ritchie explains the joke at the link.

Part of the hacker psyche is a delight in playful humor and it’s sad that the sort of droids that used to read Datamation have done everything they can to stamp it out. These days the humor exists—if it exists at all—in the source code where the suits are unlikely to discover it.

Posted in General | Tagged , | Leave a comment

Org Agenda Tasks

Charles Choi has published an interesting post on defining org agenda tasks. All Org users, I’m sure, are familiar with the Org Agenda that lists the Org headlines in each of the files in org-agenda-files and provides a link to each of those headlines.

The agenda is actually pretty malleable. Lots of people—perhaps most people—use it as a sort of calendar to list and track their tasks and appointments. I do some of that too but I also use it as a sort of log file of my daily activities. It’s easy to adopt it to your particular workflow.

To a first approximation, Choi’s post deals with ways of controlling when items appear in the agenda. For example, you may want a task to appear in the agenda around the time you’re supposed to start working on it and stop appearing when it’s completed. There are all sorts of nuances controlling the display of agenda items and even the experienced Org user may not be familiar with them all.

Choi then moves on to clocking tasks and how to handle that from the agenda. It is, he says, easiest to start and stop the clock from the agenda. In addition, there are speed keys to display the times spent on a task. Something I didn’t know was that you can arrange for a timer to persist over Emacs invocations. Choi explains how to set this up. If you’re using clocking, you should definitely do this.

Finally, Choi ends his post with a short list of best practices for dealing with the agenda. The post is definitely worth a few minutes of your time.

Posted in General | Tagged , | Leave a comment

2-Column Editing

Emacs Elements has an interesting video on something I didn’t really know about: 2-Column editing. I say “really know about” because I always assumed it was just another name for follow mode. But, of course, it’s an entirely different thing.

Even after watching the video and reading the Emacs manual entry, I still couldn’t give a clear explanation of its purpose. The TL;DR is that if you have a buffer that contains vaguely table like data where there’s some notion of columns, you can “split” the data between columns with each column being in its own buffer. These two buffers are displayed side by side and can be edited independently. When you’re finished editing, you can merge the two buffers back together.

I’m doubtlessly suffering from a lack of imagination but I’m having a hard time figuring out a use case for this. As far as I can see, you can do all the same editing almost as easily without learning the somewhat confusing 2-column commands.

You, of course, may disagree. Obviously some people do or the facility wouldn’t exist. Take a look at the video and see what you think. The video is 11 minutes, 42 seconds so it should be easy to fit in.

Posted in General | Tagged | Leave a comment

Zamansky: Learning Elisp #9

Mike Zamansky is back with the concluding video in his function header project. It’s the 9th video in his Learning Elisp series. This video ties up the loose ends in the previous videos in the project and provides a serviceable function to generate header comments for C-like languages. The final function generates javadoc formatted headers but it’s trivial to change the form by altering the format strings to be what you need.

The new ideas in this video include:

  1. Using string-split, string-join, and mapcar to parse and format the individual parameters and recombine them into a printable string.
  2. Using save-excursion to return the point back to where it was when the function was invoked.

The next project will involve inserting emojis by name into Emacs text but that will have to wait until Zamansky gets back from a European trip. He says that will be in mid October but that he might fit in a short video before he leaves.

In any event, the current video is 24 minutes, 20 seconds so you’ll definitely need to schedule some time. This video presents the development of a real function that an Emacs user might want to write to aid in their day-to-day development. Indeed, the function is a recreation of an actual function that Zamansky wrote years ago when he was an active developer.

Posted in General | Tagged | Leave a comment

Striving For A Mouse Free Workflow

As I’ve often suggested—most recently here and here—I try to minimize my use of the mouse as much as I can. Mostly that’s been in the context of Emacs where it’s easy. My desire to avoid the mouse is not ideological. It’s a matter of ergonomics. I find it faster and easier to to do my navigating from the keyboard.

Recently, I was reading an excellent article by Gwern on Internet Search Tips. It’s about how to optimize your Google-fu and search for hard to find papers, books, and other pieces of information.

One of the things that struck me was his insistence that your search has to be very easy to make or you won’t bother. The first part of his article is about keyboard shortcuts that he uses to initiate a search. He almost never needs to use a mouse for this. He’s a Linux user so much of his specific workflow doesn’t apply to me but I did take the general principle to heart.

I’ve had Alfred installed for a long time but hardly ever used it. I used it mostly to launch an application without having to click on its icon. After reading Gwern’s article, I tried to internalize this as a way of minimizing my mouse use. It turns out that the real power of Alfred resides in a subscription based plugin. I signed up for that and was amazed at how easy it made avoiding mouse use. For example, instead of clicking on 1password, scrolling down to the site I needed the password for, clicking on menu, and then clicking on the link to login page for the site, I merely brought up the Alfred prompt, typed 1p <site name> and I was taken right to the login page with all the password data filled in.

I’m still learning Alfred but already it’s essentially eliminated mouse use for everything except my browser. Browsers are the ultimate mouse-centric application for most of us and I’ve yet to find a reasonable way of avoiding the mouse when I’m in Safari. I’ve tried Keys for Safari, which tries to provide mouse free usage but it didn’t work for me.

The main point of this post is that whatever platform you’re on there’s something like Alfred that helps you avoid the mouse. If, like me, you like to avoid using the mouse, it’s worthwhile taking a look at one of the applications like Alfred that are appropriate for your platform.

Posted in General | Tagged , | Leave a comment

Weather Update

Idalia did indeed move a bit West resulting in a minimal impact in Tampa. The Irreal bunker didn’t lose power and had only moderate winds. The weather people say it’s possible we could get some more wind so it’s possible, I suppose, that we could still lose power but I don’t expect that.

I’ll push today’s regular post shortly.

Posted in General | Tagged | Leave a comment