Using Table Data in a Shell Code Block

Just a quickie on a quickie from Grant Rettke. The quickie is an example from Rettke on how to import and use a table in an Org code block using shell. The secret is that the table entries get passed in as arguments to the command specified in the shell block.

That’s good to know but Rettke’s example raised two questions for me. The first is what would happen if the table data had more than a single column. The answer is that it does just what you’d think it should. I reran Rettke’s example with the table

#+name: data
| 1 | a |
| 2 | b |
| 3 | c |
| 4 | d |

and got the results

#+RESULTS: code
#+begin_EXAMPLE
1	a
2	b
3	c
4	d
#+end_EXAMPLE

The second question was how he got his results wrapped with the #+begin_EXAMPLE, #+end_EXAMPLE delimiters. I thought that maybe he put the #+RESULT: code in between those delimiters but that didn’t work. The only way I could see to do it was to use the :wrap keyword in the header arguments:

#+begin_src sh :var arg=data :results output :wrap EXAMPLE

Perhaps Rettke will drop by and share his secrets with us. In the meantime, if you want to deal with a table in a shell code block, this is how to do it.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Gray on Gray

Over at the Emacs subreddit, Lalelul wants to know How can I fix hard to read (gray text on gray background) dialog boxe? As soon as I saw it, I deleted the browser tab but I was too late. The Minions had noticed.

They started jumping up and down and insisted that I provide the answer: “Don’t use unreadable dark themes.” Problem solved.

RMF humor aside, why would anyone do this? In a sense it doesn’t matter because the users of these themes are hurting no one but themselves but the Minions—and to tell the truth, I—don’t understand why anyone who isn’t a misanthrope would design a theme in which the menus are unreadable. Maybe it’s a way of encouraging users to eschew menus and learn Emacs key sequences.

One of the features of Emacs is that it enables ultra-efficient editing but when you design themes that are hard or impossible to read, you’re nullifying that efficiency. To channel Nancy Reagan, “Just say no.”

Posted in General | Tagged , | Leave a comment

On Org Alternatives

There’s a phenomenon that I both understand and don’t understand. That phenomenon is happy Emacs or Org users feeling the need to try out every alternative that comes their way. Notice I said “happy” users. If Emacs or Org isn’t working for you, then of course you’d seek an alternative. What I’m talking about are those who’re happy with their Emacs/Org experience.

On the one hand, I can understand the eternal search for the best possible tools and that entails trying out new candidates. On the other hand—unless you’re a software reviewer—your job is not to find the best editor or outliner/todo manager. When you find one that meets your needs well, it’s time to stop actively searching and fallback to “stumble on mode”. By that, I mean if you stumble across an app that for one reason or another appears to meet your needs better, it’s worth giving it a look. Otherwise, spend your tool cycles mastering the ones you already have.

Eric MacAdie has come to a similar conclusion. For a long time he kept a list of Org mode alternatives that he planned to try out. The list got longer and longer and one day he realized that Org met all his needs and, given Org’s extensibility, was likely to continue to meet his needs in the future.

He’s got a great quote from a Hacker News discussion on one of those alternatives. I’ll let you read it on his site or at the link above but the TL;DR is that if you’re looking for a plain text outliner/todo manger you can not do better and are unlikely to ever do better than Org mode. Not only is Org better than anything else, it’s not even close. The quote reminds me of Neal Stephenson’s line about Emacs outshining its competition.

If you believe that it’s somehow incumbent upon you to always be searching for something better than Org even though Org is meeting all your needs, take a look at MacAdie’s post and be disabused.

Posted in General | Tagged , | Leave a comment

Screenshots and Recording

Another day, another Álvaro Ramírez post. It’s hard to keep up. His latest post is macOS specific but very useful for those using a Mac who want to take a screen shot or capture a video. The Mac, of course, has a built-in way of doing this but it’s one of those obscure things that you probably don’t know about unless you’ve made a specific effort to research how to do it.

You can check Ramírez’a post to see how to do it but it’s as simple as invoking a key sequence. Taking a screen shot, Ramírez says, works well but he’s less happy with making a screen video. The problem is you can’t specify a window directly. You have to use a region and that may lead to including some background or wallpaper in the video.

That’s a little annoying but Ramírez, of course, can’t let it stand. His post, Recording and screenshotting windows: the lazy way, explains his solution to all this. The TL;DR is that he wrote a utility to help with capturing screenshots and videos and then integrated it into Emacs with his dwim-shell-command package. It’s a nice solution.

If you’re a Mac user and especially if you’re in the intersection of Mac and Emacs users, you may find his post useful. Ramírez’s solution provides a very easy way to capture screenshots and videos for blogs or reports. Definitely worth a look.

Posted in General | Tagged , | Leave a comment

Making Your Unix Command Names Unique

I’ve been a Unix-head working exclusively in one flavor or another of Unix for more years than I care to contemplate. These days, I seldom see a Unix workflow tip that I didn’t already know about. Still, I do sometimes stumble across something new and useful. The latest such stumbling is this tip from Brandon Rhodes explaining how to make your Unix command names unique.

It’s a common problem. You’ve written a script or compiled program to perform some task only to find that your chosen name conflicts with one of the system command names. Even worse, a system update introduces a command with the same name as one of your longstanding commands.

Rhodes’ solution is incredibly simple but I’ve never seen anyone recommend it before. The idea is simply to preface your command names with a comma. Your reaction is probably like mine, “Wait, that can’t be legal syntax.” But it is and best of all none of the system commands use the convention. That means that starting your command names with a comma guarantees they won’t conflict with any of the system names.

There are other candidates for a unique leading character but as Rhodes says the comma is ideal because it is both unique and easy to type. His solution is much better than prefacing the command with “my-” or your initials. It’s one extra, easy-to-type character that solves the problem once and for all.

Posted in General | Tagged | Leave a comment

Time Spent in Emacs

Pavel Korytov is a fairly new Emacs user. He’s been at it for about two and half years but as seasoned Emacs users know, the learning never ends and even those of us with 15 or more years in are still in the learning phase.

He’s got an interesting post, 916 days of Emacs, that looks at how he spent his time in Emacs. He uses ActivityWatch and WakaTime to track his tube time so he has some pretty accurate statistics on the matter.

It’s an interesting post: his usage patterns are very different from mine. It’s especially nice to see his initial learning phase times. None of this makes any real difference, of course—it’s just an engaging peek into someone else’s Emacs use, and the beginning of their Emacs journey. Take a look if you’re interested in such things.

Posted in General | Tagged | Leave a comment

Tech Journalists Are The Worst

That headline is a cleaned up version of my original attempt. Irreal has a long history of documenting the silliness and failings of the Tech Press but even so I am always surprised at their cluelessness and dishonesty.

If there’s one thing sure to provoke their irrational ire it’s Apple. The latest example is the recent Apple program of offering interest on Apple Cash balances. As reported by Daring Fireball, Martin Peers wrote a really silly article bewailing how insecure it is to entrust bank account and other sensitive information to your iPhone.

Daring Fireball’s John Gruber decimates that argument. The TL;DR is that the loss of your iPhone alone does not mean financial doom: You have to lose both the phone and the device password. In fact, having that information on your phone is much secure than having it in your wallet, which makes all the information immediately available to the thief. Read Gruber’s post for the details.

Peer’s article puts me in mind of a previous Irreal post on supposed iPhone insecurity. The very best case that can be made for these clowns is that they’re ignorant but, sadly, the more likely explanation is dishonesty. Every sensible person understands that information on your phone is more secure than the same information in your wallet. To pretend otherwise can only be ascribed to dishonesty.

There are, I’m sure, plenty of reasons to dislike Apple but if you want to press that case, at least find an example that makes sense. Peers’ offering doesn’t stand scrutiny.

UPDATE [2023-04-23 Sun 14:12]: Rereading this post make me realize that it may seem that I’m accusing Peers directly of dishonesty. That is not my intent. I’m am merely pointing out that it’s hard to avoid the suspicion of bad faith in his argument against Apple.

Posted in General | Tagged , , | Leave a comment

Shell Maker

I’ve written a couple of posts about Álvaro Ramírez’s implementation of Emacs shells for ChatGPT and DALL-E. After he wrote those, he noticed that they shared a lot of code so, of course, he abstracted that code out into a separate package of functions.

The result is a wrapper around comint, shell-maker, that makes it easy to build a specialized shell. He offers a trivial example of a shell, greeter-shell that accepts a name, X, and responds with Hello "/X/". That’s not terribly useful, of course, but it takes just a few lines of code—most of it boilerplate—to implement.

Right now shell-maker is bundled with chatgpt-shell but Ramírez says he will break it out to a separate package if there’s enough interest. Regardless, if you want to implement a specialized shell—whether or not it’s in service of the hot new AI apps—the shell-maker package is an easy way to do that without worrying about the intricacies of Comint. Take a look at Ramírez’s post for the details.

Posted in General | Tagged | Leave a comment

Red Meat Friday: Throw Away That Soap

Another skirmish in the Vi(m) vs. Emacs wars. What do you do when you discover that your girlfriend uses Vim kitchen soap? If you’re an Emacser, the answer is clear: you tell her you have to throw it away.

That’s an old joke by now but some of the comments are funny. The first and best is “Good luck figuring out how to quit it.” thereby combining two memes. Someone else suggested keeping it around for quick and dirty jobs.

All of this is fun as long as you remember that it’s just a silly diversion and shouldn’t under any circumstances be taken seriously. Of course, there are some who will take it seriously and they, paradoxically, will have the most fun with it.

Posted in General | Tagged , | Leave a comment

Describing Emacs In A Single Line

SnipingMan18 has posed an interesting questions on the Emacs sub-reddit: How would you describe the Emacs philosophy in a single line? If you’re an Emacser, take a moment to think how you would answer that question.

My answer popped into my head almost immediately so I read all the comments to see if anyone had the same take: no one did. Some of the answers were silly, but others made a lot of sense. For example, it’s hard to argue that “the extensible editor” captures (at least one) essence of Emacs. Another nice answer was “have it your way.” That certainly captures an important part of Emacs as I’ve often noted. Another good candidate is “the DIY editor”.

All of those answers provide a good, concise, précis of what Emacs is about but none of them nail down what makes it so special to me. Regular readers won’t be surprised that my answer is “Lisp machine lite” or something like that. The point is that Emacs is not merely an editor but an operating environment to handle all your routine chores. It is, in fact, an environment for hackers to solve problems in, even if those problems don’t involve writing code.

As I’ve said many times, the only app other than Emacs that I spend significant time in is Safari. When Emacs finally solves the problem of providing a usable Web interface—sorry, EWW is not there yet—probably 95% of my tube time will be spent in Emacs.

Your answer may differ but it’s hard to argue that Emacs provides an useful and powerful Lisp environment.

Posted in General | Tagged | Leave a comment