The rs Command

Dr Drang over at And now it’s all this has an interesting post on the Unix rs command and his use case for it. The “rs” stands for “reshape”. The idea is that given some data arranged in rows and columns, rs will change the number of rows—and therefore columns—resulting in a change of “shape” of the data. The command is a bit obscure. I’ve been using Unix since 1990 and don’t remember ever coming across it much less using it.

Still, as Dr. Drang shows, it can be really useful for reformatting data to better fit the space it lives in. Dr. Drang’s use case is to insert a long list of numerical data into an email. The list was long so he didn’t want to just paste it into the email because it would have made the email too long. Instead, he used rs to insert it as 14 rows of 6 columns, which made it fit nicely.

The command is actually quite flexible and has many options. Dr. Drang demonstrates a couple of them that he used to make the data look better. Read the post for the details.

It’s interesting that this command is still around. Oddly, it’s a macOS builtin, resulting, no doubt, from macOS’s BSD heritage. I can’t imagine it gets used all that much but when you need to change the shape of some data, it’s just the thing.

Posted in General | Tagged , | Leave a comment

Describe Symbol

A short post for a lazy Sunday. Grant Rettke over at Wisdom and Wonder has a quick tip. He recommends trying describe-symbol for invoking Emacs builtin documentation. He says that it’s almost always what you want when you invoke describe-function or describe-variable. As far as I can see, it’s the same information. I looked at the source code but it was hard to tell if it adds extra data or not.

You invoke it with Ctrl+h o so if nothing else you need remember only one shortcut for your documentation needs.

UPDATE [2022-09-25 Sun 16:31]: Grant remarks in the comments that one of the reasons he likes describe-symbol is because it tells you when there is a variable and function with the same name.

Posted in General | Tagged | Leave a comment

Extending Org Links and Youtube

Charanjit Singh has an interesting post on extending org-mode to handle youtube links. His goal was two-fold:

  1. Have an Org link type for Youtube videos that opened the video in mpv instead of the browwser
  2. When exporting to HTML the link should result in an embedded video rather than a link to Youtube

Most folks probably aren’t going to have those requirements, of course, but Singh’s post is still useful because it’s a great go-by for how to define and implement special links in Org-mode. The TL;DR is that you define a link type and two actions associated with it. The first action is what to do when the link is followed (Ctrl+c Ctrl+o). The second is how to export the link (Ctrl+c Ctrl+e).

In Singh’s case, the follow action is to display the video with mpv unless the follow is invoked with the universal argument in which case the browser is used. For export, Singh cares only about HTML for which the necessary markup for an embedded video is output.

The code is easy to follow so if you have a case for a special Org link, it’s worthwhile taking a look at Singh’s post to see how things are done.

Posted in General | Tagged , | Leave a comment

Border Authorities Seize and Store Phone Data for 15 Years

The US government has long maintained the fairy tale that the borders are somehow a civilrights-free zone and the Customs and Border Protection (CBP) agents can do whatever they like without having to worry that pesky 4th Amendment or other procedural safeguards. There’s no support for this idea in the constitution and as far as I can see the government made it up out of whole cloth. Sadly, the courts have acquiesced so that’s the world we live in.

Engadget has a disturbing article on how CPB agents can and do copy user data and store it in a database for 15 years. Once in the database, the data is available to DHS agents to rummage through without securing a warrant or even having to record their reasons for accessing the data.

As usual, Sen. Ron Wyden is on the case but, sadly, he is, also as usual, a lone voice. In a letter to the commissioner of CBP, Wyden lays out the type of data seized and the questionable legal basis for taking and storing it. He asks the commissioner to develop a plan for dealing with this problem and to let him know what it is no later than the end of October. I—and I’m sure Wyden—am not holding my breath.

Posted in General | Tagged | Leave a comment

Emacs Is Not Just a Text Editor

Over at the Emacs subreddit, analysis230 has a sort of confession. He had long considered the phrase “Emacs is not just a text editor” to be something geezer developers said as they clung desperately to an aging technology. He says he didn’t even know what it meant.

Then one day for unspecified reasons he decided to move from VS Code to Emacs. He was already familiar with the Vim keybindings so he was up and running (with Doom Emacs) in short order. He really liked modal editing and found himself wishing for a keyboard-driven file manager. That’s when he discovered dired and, as he put it, the penny dropped. He finally understood what everyone meant when they said that Emacs is not just a text editor.

He’s since moved on to installing Mu4e but his story makes an important point: it can be hard to understand and appreciate the power of Emacs until you’ve learned some basics and used it for a while. Lots of worthwhile things in life are like that.

Speaking of the “not just a text editor” quote, analysis230 says,

I know I heard people say that but I always thought of them as denial-filled ramblings of people who have sunk a decade into learning a tool that’s slowly fading. Apparently, not the case at all.

His post is, it seems to me, the perfect answer to those who complain that Emacs has a steep learning curve. It may have but the it’s worth the climb.

Posted in General | Tagged | Leave a comment

Webster 1913 and dictionary.el

Time moves on and things you thought you knew turn out to be not as accurate as you hoped. This happened to me recently in regard to using the Webster 1913 dictionary in Emacs. I recently posted about James Somers’ article on Webster’s 1913 and how to use it from withn Emacs. In it I repeated my advice to follow Marcin Borkowski’s recipe for making this wonderful resource available from within Emacs.

In the comments to that post, acdw and Brian Green note that the dictionary is now available from dict.org and that—as of Emacs 28—you can access it from the built-in dictionary-search. That means that any Emacs user can take advantage of this splendid resource without downloading extra packages or data.

If you call dictionary-search without configuring anything, it will prompt you for the dictionary source with a default of dict.org. As Green says, you can avoid that by simply adding

(setq dictionary-server "dict.org")

to your init.el.

That will give you all the definitions from Weber’s 1913 as well as the other dictionaries located at dict.org. If you’re coming to this post without the benefit of reading the backstory, you should definitely read Somers’ post, You’re probably using the wrong dictionary to see why you should bother with Webster’s 1913 to begin with. It is not, after all, the most modern dictionary but as Somers explains, it is the best if you’re looking for just the right word.

UPDATE [2022-10-06 Thu 20:18]: Fixed link to previous post.

Posted in General | Tagged | Leave a comment

Bespoke Notetaking with Org-mode

Matt Young over at Code Thrasher describes his bespoke notetaking workflow based on Org-mode. Rather than depend on packages like Org-roam for things such as backlinks, Young implemented his own version that worked just the way he wanted.

For example, in addition to backlinks, Young implemented a database that linked a person in his database to the any headlines that involved them. That allowed him to answer question like, “Who did I discuss [some topic] with?”

His setup is very idiosyncratic but finely tuned to work exactly the way he finds most useful. Others who don’t want the heavy machinery of things like Org-roam may find his system useful.

Regardless, the main takeaway for me is that his workflow is yet another example of how flexible Emacs is. You can bend it in almost any direction to get just the workflow you want.

Posted in General | Tagged , | Leave a comment

Why Use Org

Over at the Emacs subreddit, YakumoYoukai wonders why he should use Org-mode. He’s not some clueless n00b whining that it’s all too hard and why should he bother anyway. YakumoYoukai is a 30 year, dedicated, user of Emacs who doesn’t get what Org-mode is about and is looking for some tutorials or overviews.

You see this type of request a lot. They all result from the natural desire to understand everything that Org can do or to at least have an overview of its capabilities. The truth is Org is ever-evolving and it’s hard to get a grasp on the overall picture. Org-roam is an example. It’s a fairly new addition to the Org panoply that didn’t exist for most of the life of Org-mode so if your view of Org was not formed recently, it’s out of date.

My advice to people like YakumoYoukai is what it’s always been: don’t try to understand the whole package. Instead, pick a particular problem and investigate how Org can help with it. It’s much easier to find videos and tutorials dealing with some particular aspect of Org than it is to find any that cover the whole package.

Once you’ve solved that first problem, look at what else Org might help you with. My own journey started with using Org as a sort of time logging application. I expanded that into a more general agenda and record keeping application, and finally into my main writing engine. Somewhere along the line I started using code blocks as a sort of low level literate programming. I’ll doubtless use it for additional tasks as they come up.

Even though I’ve been using it almost as long as it’s existed, I still don’t understand the whole package. Like Emacs itself, there’s always more to discover and learn.

Posted in General | Tagged , | Leave a comment

Delete to Trash from Within Emacs

Generally you have to work hard to delete a file from within Emacs but it is possible. The most common way is probably with Dired but my favorite is with Magit. Regardless, once you get used to using Dired or Magit to delete files it can be distressingly easy to inadvertently delete a file.

The problem is that with vanilla Emacs the file is gone when you do. Most modern OS file delete operations move the file to the Trash folder where it can be retrieved but that doesn’t happen when you delete from within Emacs.

Álvaro Ramírez has a solution. It’s possible to tell Emacs to move files to the Trash folder instead of actually deleting them when asking Emacs to remove them. Ramírez’s solution is specific to macOS but the same idea mutatis mutandis should work for any OS that has a Trash folder.

I’ve known about this hack for some time but have never bothered to implement it. That’s just foolish because sooner or later I’m going to lose a file and wish I hadn’t been so lazy. Don’t be like me: tell Emacs to make your deletes provisional. That way if you inadvertently delete a file it will be easy to recover. The change is easy to implement and there really isn’t any reason not to install it.

Posted in General | Leave a comment

Webster’s 1913 Redux

Seven years ago, I wrote about James Somers’ beautiful article on John McPhee’s New Yorker article, Draft #4. If you write any prose at all, I urge, urge, you to read Somers’ article. It will be a revelation to you.

The very abbreviated TL;DR is that after McPhee has done all the creative work on a piece of writing, he looks for ways to “punch up his writing.” He does this by looking up words in his Webster’s 1913 dictionary. Read Somers for why the choice of dictionary is important.

For a long time the dictionary was available on line from the University of Chicago but, sadly, it disappeared and has not returned. Happily, Marcin Borkowski found a way to make the dictionary available from within Emacs. I’ve used it ever since when I’m stuck on finding the right word. If you’re an Emacser, you should follow Borkowski’s recipe and install it in your Emacs too.

I’m revisiting this because Mario Jason Braganza has rediscovered Somers’ post and, like me, was enchanted. Somers’ article tells you how to add the Webster’s 1913 to your macOS dictionary app so you can have it available even if you’re not an Emacs user. Braganza also points to a new on line version of the dictionary that I didn’t know about. Since I do virtually all my writing from within Emacs now, I no longer need an on line version but I’m glad to see this valuable resource available to everyone.

Posted in General | Tagged | Leave a comment