DWIM Shell Command On Melpa

A quickie with some good news. Álvaro Ramírez’s excellent dwim-shell-command is now available for download from Melpa. I’ve written several posts on this package [1, 2, 3] and really like what Ramírez is doing with it so I’m glad to see it’s now easily installable.

Ramírez’s post says that the package should soon be on Melpa and when I checked, it was already there. Ramírez has links to his previous posts on his announcement so if you aren’t already familiar with it, you should take a look. His posts give you a good idea of what it can do. If you’re like me and want to make Emacs the nexus of your computer activities, this package is a boon.

Posted in General | Tagged | Leave a comment

Programmers and the Flow

Every programmer knows about the flow. They know about it even if they don’t know the word “flow”. Sadly, most other people are not familiar with the concept. Especially members of the management class. This cartoon captures the idea perfectly.

But there’s a practical matter. What should a programmer do about the clueless manager (or colleagues) who think nothing of toppling the carefully constructed tower of cause and effect?

Erik Dietrich has an answer. The TL;DR is that you should present your manager with a list of numbers and offer to buy lunch if he can add them up in his head within 30 seconds. Once he starts, you interrupt him with random questions and observations until he gives up in despair.

It’s a delightful idea and seems attractive but I’m not sure it would work. The problem with the type of interrupter we’re talking about is that they think whatever they imagine their current problem is, it’s special so the usual rules don’t apply. That’s true even if their current problem is, “when do you think you’ll complete that task I asked you to do.”

Still, it’s an amusing idea and worth a read even if you probably wouldn’t use it yourself. The hard truth, though, is that the only real solution is probably working late where there’s no one around to bother you. Perhaps working from home will be the ultimate solution.

Posted in General | Tagged | Leave a comment

Digital Nomads in 2022

Long time readers know that I’ve been fascinated by the idea of digital nomads since reading Mike Elgan’s article on The New Bedouins in 2007. Back then, it was mostly journalists and a few IT people who were able to live the life of the digital nomad. Since then, the practice has become much more common and there are now many companies that operate exclusively with remote employees.

The practice has become so mainstream that even Bloomberg has taken notice. They’ve published an article that serves as an update on digital nomadism. Being a digital nomad is a little different from what’s become known as “remote work”. The digital nomads don’t want to work from home; they want to go to exotic, usually warm, places. They’re very apt to move on after a few months for somewhere new so they’re not digital expats either.

Of course, being Bloomberg, the article makes the point that the digital nomadic life may not be for everyone and can be fraught with difficulties. There are local laws and tax issues to deal with and as the article observes, the beach is just about the worst possible work environment.

If, like me, you’re fascinated with the idea of working from exotic, pleasant places, take a look at the article. They even have a list of the top five destinations (for various values of “top”).

Posted in General | Tagged | Leave a comment

The Case for Emacs, Vim, and Nano

Over on the Red Hat site there’s a post that makes the cases for the Emacs, Vim, and Nano editors. That may seem like blasphemy to some but different people do have different needs and expectations from their editors.

The first problem is that the post begins with the quote, “Text editors. They aren’t something that most users put a lot of thought into.” Huh!?! Sometimes it seems like that’s all we think about. As ESR once said, programmers spend most of their tube time in their editor so of course we spend a lot of time thinking about them.

I’ve used all three of those editors, although I’ve used Nano only when building a Gentoo Linux system until I could get a real editor installed. The section on Nano pretty much supports this: It’s a simple, straightforward editor that’s intuitive and easy to use. I’m not sure why any serious developer would use it other than to bootstrap a system where other editors aren’t available.

I thought the section on Vim was the best and most compelling. The writer, Ricardo Gerardi, makes a good case for Vim and details all its advantages. It’s fast, light weight, and has the wonderful composable command set.

Sadly, the Emacs section was the least persuasive. As I’ve said many times before, if you want a fast, flexible, intuitive editor, Vim is for you. If you want a programming environment that serves as a sort of operating system—or more to the point, a sort of Lisp Machine—then Emacs is for you.

As for Nano, I suppose you could think of it as a replacement for ed in those situations where you need an extremely lightweight editor to get things going but I can’t imagine using it in my day-to-day work. Of course, other folks disagree. The nice thing is that there are plenty of editors that will meet almost anyone’s needs.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Seek Help

Here’s a stunning example of retro abuse. I get that it’s fun—for some people—to revisit old tech but if this looks good to you, seek help. I’m old enough to have worked with those terminals—both the green and amber versions—and I can tell you, unequivocally, that there’s no way I’d choose to go back.

Emulations like this are fine for pranking that annoying guy at the office but I can’t imagine anyone choosing to use it. But that’s me. Judging from the comments, there are a lot of folks who disagree. Whatever floats your boat as they say but I’m happy running Emacs in GUI mode and failing that in a decent, modern terminal.

Of course, all this from a guy who yearns for his very own Lisp Machine.

Posted in General | Tagged , | Leave a comment

Mickey On Shells & Emulators

Mickey from Mastering Emacs has posted an excellent summary of shells & emulators in Emacs. The subject can be a little confusing—mostly centering around the difference between a shell and an emulator—so if you’ve ever been uncertain if you should be running shell, term, or ansi-term be sure to check out his post.

If you’ve used any of those you know that they all have limitations. Mickey’s post tells you how to work around some of those limitations and how to do things like change the default shell or stop the duplicate echoing of shell input. He also discusses Vterm and Eshell.

Mickey’s first recommendation is to consider whether you need a shell at all. Emacs, after all, has Dired for file manipulation, Magit for Git interaction, built-in network utilities, and the compile function to compile and test your code. Even as a long time command line guy, I’ve found that I rarely need to invoke a shell these days.

If you do need a shell, Mickey recommends either shell or eshell. These have the advantage that you’re working in an Emacs buffer so you have all the usual Emacs capabilities available for working with the text. I like Vterm because it gives a much better emulation than the others but as Mickey says, you won’t have the valuable Emacs features available for working with the buffer.

Finally, there’s a long list of comments that are also worth reading. Especially Ramin Honary’s comment on using coterm for better terminal emulation. As always with Mickey’s posts, this one is very much worth reading

Posted in General | Tagged | Leave a comment

Google and Your Data

I’ve told you, and told you, and told you but some people aren’t listening. Here’s a tweet from a graduate student who, as part of a Digital Archiving class, had a list of people running in a local election and stored it on her Google drive. Google, of course, deleted it.

The tweet itself is bad enough but follow the thread by clicking on “Read the full conversation on Twitter.” In particular, take a look at this response:

Years of data lost because some Google algorithm got it wrong.

Kramer appears to be pursuing a graduate degree in Library Science so you’d think she’d be a little bit more savvy. Google has a well established track record of doing this sort of thing and as someone interested in digital archiving you’d think she’d know this. Or at least that her professor would.

As I’ve said before, I used to feel sorry for these people but no longer. If you keep committing your data to a service that thinks it’s their duty to delete your data for various dubious reasons, you’re going to get what you deserve. At least backup your data on a portable drive. They’re dirt cheap: even a grad student should be able to afford one. Just don’t expect tears from me.

AFTERWORD

After I wrote this but before I published it, this story appeared. Just think: a million words lost. Irreal knows about a million words and it is, believe me, a lot to lose. To be sure, this is in China but the principle is the same. Commit your work solely to someone else’s computer and you’re going to suffer.

Posted in General | Tagged , | Leave a comment

Eshell Prompts

Just a quickie today. Bytedude wanted to customize his Eshell prompt to add the date/time. With most shells, that’s simply a matter of changing an environment variable but with Eshell it’s a little more complicated.

It turns out the Eshell forms the prompt by calling a function and if you want to change the prompt you have to provide a new function. That’s easy because the function is pointed to by a variable so you need only change the variable to point at your own function. The function itself need merely form the desired string for the prompt.

A slight complication is that Eshell needs to be able to recognize prompts. It does that with a regex so if you change the prompt, you may need to change the regex. Take a look at Bytedude’s post for the details. The Emacs Wiki also has documentation on setting Eshell prompts that is worth taking a look at if you’re interested in customizing your Eshell prompt.

Posted in General | Tagged | Leave a comment

Quadratic Equations Reconsidered Redux

I did a poor job of making my intended point in Irreal’s Quadratic Equations Reconsidered post. The intended point was that Loh had discovered a method of solving quadratic equations without having to remember—or, heaven forefend, rederive—the quadratic formula or to invoke the usual guessing at the factors.

The post showed why the roots of \(x^{2}+bx+c\) sum to \(-b\) and have the product \(c\). The second observation was that since the sum of the roots is \(-b\) their average is \(-b/2\) and that therefore the roots must have the form \((-b/2-u)\) and \((-b/2+u)\) and that since their product is \(c\), we must have \(u^{2}=b^{2}/4 -c\).

I left the technical details there and judging from the comments, readers thought the method involved remembering \(b^{2}/4 -c\) instead of the quadratic formula. They even pointed out that \(b^{2}/4 -c\) is really just the usual discriminant, for the special case of \(a=1\), in the quadratic formula.

But the real point was the method so let me solve a couple of equations to illustrate. First up: \[x^{2}-8x+15=0\]
The roots sum to \(8\) so their average is \(4\) and therefore the roots are \((4-u)\) and \((4+u)\). Since their product is \(15\), we have \(16-u^{2}=15\) so \(u=1\) and the roots are \((4-1)=3\) and \((4+1)=5\).

When the \(x^{2}\) coefficient is not \(1\), we just divide by it first. Thus to solve \[2x^{2}+8x+6=0\] we divide both sides by \(2\) to get \[x^{2}+4x+3=0\]
Now, the roots sum to \(-4\) so their average is \(-2\) and the roots are \((-2-u)\) and \((-2+u)\). Since their product is \(3\) we have \(4-u^{2}=3\) so \(u=1\) and the roots are \((-2-1)=-3\) and \((-2+1)=-1\).

I chose those roots to be simple integers so as not to bog down in more complex arithmetic but the method works fine when the roots involve radicals or are complex. The point is that the only thing you have to remember is that the sum of the roots is \(-b\)—and that therefore the roots are of the form \((-b/2 \pm u)\)—and that their product is \(c\).

Posted in General | Tagged | Leave a comment

DWIM Shell Now Supports Multiple Languages

Álvaro Ramírez continues to experiment with his DWIM Shell Command package. The basic idea was that to provide a framework that made it simple to invoke a command that has complex arguments and options directly from Emacs. Ramírez has published a few posts that demonstrates its use and advantages that Irreal has reported on.

Now, Ramírez has realized that sometimes you have a bit of code in some language or another to do some task. If the language can take input from STDIN, there’s no reason that DWIM Shell couldn’t invoke those too. His latest iteration does just that.

It’s a really nice extension to his previous framework. It allows you to define frequently occurring tasks as Emacs functions that invoke the appropriate commands just as if you had entered them from the shell. Ramírez notes that you can, of course, accomplish all this with Elisp but that the DWIM Shell framework provides an easy way of doing it even if you don’t know Elisp.

There’s no news as to whether this code is headed for MELPA or some other repository but it’s a single file and easy to grab if you want to play around with it now. I’m pretty fluent with Elisp so I could always do these things directly but Ramírez’s package provides an easier way to perform these functions.

Posted in General | Tagged | Leave a comment