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

The Model F Keyboard Resurrected

If you’ve been around for a while, you know that I’m a big fan of the Model M keyboard and even had one that I lost at my last job when I left. Fortunately, Unicomp resurrected the Model M and we old guys were able to enjoy the superior keyboards from our youth.

It turns out, though, that there was an earlier buckling spring keyboard: the Model F. Model F Labs has recreated this classic keyboard for modern systems. They’ve also introduced their own version of the Model M. The above article explains the difference between the Model F and Model M. I’ve never used the Model F but there doesn’t appear to be a lot of differences. The Model M is said to have “heavier” keys but they always seemed just right to me.

Regardless, if you’re yearning to recreate your past keyboard experience or you just want to see what all the fuss was about, now you can.

Posted in General | Tagged | Leave a comment

A Coda to Álvaro Ramírez’s Eye Candy Post

The other day, I wrote about Álvaro Ramírez’s post on his Emacs theme. In a nice coda to Ramírez’s post, Aimé Bertrand writes about how he configures his UI and the functions he uses to support it.

Bertrand has some nice ideas. He’s a Mac user so some of them are meant for macOS only but others work in any environment. Among the Mac specific functions are those to switch his theme based on whether the Mac is in light or dark mode.

As he points out, switching themes can be a problem because some aspects of the previous theme can remain active. He has a function that solves this problem by first deactivating the previous theme and then activating the new one.

Another nice trick is dealing with the “warning beep”. The conventional way for dealing with this is just to set ring-bell-function to 'ignore but then you get no notification at all. You can also set visible-bell to t to flash the screen instead but many find that annoying. Bertrand solves this problem with a function that flashes the mode line instead. That’s arguably better than no notice at all but less annoying than an audible beep or flashing the whole window.

Finally, he’s got a function to propertize a string in a way similar to set-face-attirbute. I don’t have a need for such a function but I can see how it’s just what you need if, say, you’re writing a package and want to specialize the appearance of a string.

As I say, Bertrand has some good ideas so it’s worth taking a look at his post. It’s fairly short so it won’t take much time to give it a read.

Posted in General | Tagged | Leave a comment

Downcasing Every Occurrence of a Word in a Buffer

Marcin Borkowski (mbork) has an instructive post based on a question in the emacs-humanities mailing list. The question that Borkowski addresses is how to replace every occurrence of a word in a buffer with its downcased version without typing the word twice. Borkowski solves this problem by writing a bit of Elisp.

In a sense, his solution is silly—as even he admits—because there are pretty easy ways of doing this with built-in commands as a couple of the respondents replied. Still, Borkowski’s solution serves as a nice example of writing a bit of Elisp to solve a simple problem.

As usual, Borkowski shows us the scaffolding. By that I mean that he doesn’t just show us a solution but the steps—and missteps—he took arriving at it. That’s why it’s an instructive post. The main thing you learn from the post is how to search through a buffer for a given regex and replace it with something else. That’s basically the interactive query-replace-regexp but you’re not supposed to call that directly from Elisp for various reasons.

Borkowski gives us the template for this sort of operation and makes it obvious how to change the operation on the target or add other steps. It’s a nice post and worth reading even if you’re already conversant with Elisp.

Posted in General | Tagged | Leave a comment