On Sharing The Benefits Of Emacs

Most experienced Emacsers recognize the futility of proselytizing for our favorite editor. Basically, no one but the already convinced want to hear about it. They’re sure the bling, menus, and mouse actions offered by those other editors are superior to an editor that’s older than most of them. But they lack something we have: experience with both their chosen editor and Emacs.

My own proselytizing is mostly confined to Irreal. I very rarely try to convince people one-on-one anymore. Of course, Irreal readers are mostly Emacs users so I’m largely preaching to the choir. Still, we do what we can do.

Gene Goykhman over at Flaky Goodness has a similar story. One thing I liked about his post is that he quotes Prot on the compounding benefits of learning Emacs. Yes, there is a learning curve and it’s (relatively) difficult for beginners to get going but before too long the compounding sets in and, as Prot says, we start to get more out of studying Emacs than we put in.

Of course, we can’t tell anyone this because they don’t want to hear it.

Posted in General | Tagged | Leave a comment

What Is Emacs and Why Should You Use It

Explaining Emacs to non-users is challenging. A first order explanation is that it’s a text editor but as we all know that’s a pitifully inadequate explanation. As you’re all aware, my default explanation is that it’s a light-weight Lisp Machine but that’s probably not very useful to anyone who doesn’t already know the answer.

Over at The Art Of Not Asking Why JTR attempts to give a simpler answer to the question. For him, as for most of us, the defining characteristic is Emacs’ configurability. JTR uses the metaphor of a coffee maker that not only brews your coffee but makes toast just the way you like it, orders coffee from your favorite roaster, and loads a crossword puzzle tailored specifically for you onto your smartphone. That’s Emacs. It does just what you want in just the way you want to do it.

With Emacs, your code becomes part of Emacs, virtually indistinguishable from the code that comes with the distribution. That means you have almost complete control over what Emacs does and how it does it. It’s hard to think of any other piece of software for which that’s true.

We all have our Emacs story and why we love it and JTR’s is a nice example of the genre. Probably no one but JTR will be completely satisfied with his story because, as I say, we all have our own.

Posted in General | Tagged | Leave a comment

Working From Home: Is The Dream Over?

I am so tired of reading the same excuses and nonsense from psychopathic control freaks on why it’s absolutely necessary for the good of the company/city/country/world/universe that all workers return to the mothership office.

The latest horrifying example is from the City of Philadelphia. The Mayor, Cherelle Parker, is convinced that worker presence in the office is necessary for equity because it promotes stronger social connections, better collaboration and fairness in the workplace. She didn’t mean it, of course. That silliness about connections and collaboration has been debunked over and over by actual research as opposed to the “gut feelings” relied on by the control freaks whose “leadership philosophy” boils down to having everyone in their seat so that the managers can be sure they’re really working. “Fairness” appears to mean that because not everybody can work from home, no one should be allowed to.

In what amounts to a Kinsley gaffe, Mayor Parker explained her goal with the program is to revitalize the downtown. In other words, to bring people into the downtown who will patronize restaurants, shops, and other city businesses. She’s also hoping that the city governments policy will shame the private sector into doing the same.

The story, from NPR, is centered around a city employee, Andrew DiDonato, who reviews construction plans for the City’s licensing authority. There’s no reason, of course, that he can’t do that from home. Indeed, he’s been doing exactly that for the last four years. During COVID, the city was forced to allow DiDonato and other employees to work from home and DiDonato discovered that he was able to be a better parent and husband by being there to help get the kids off to school and to support his wife.

Sadly, all that’s coming to an end. DiDonato loves his job but is considering leaving rather than have his life disrupted. The city will lose a good worker but at least citizens can be sure that their city workers are being monitored.

Posted in General | Leave a comment

Elfeed Org Links

As most of you know, I’m a huge fan of Elfeed and, of course, Org mode. I use Elfeed to read my feed and I do all my writing and note taking in Org mode. It’s natural, therefore, that I’d want a way of capturing Org links to the Elfeed content. You can sort of do that by killing the current content URL to the kill ring and then yanking the link into some other document. That works but it’s not as convenient as simply calling org-store-link and inserting the link with org-insert-link because the saved link doesn’t live in the kill ring and use using the Org functions will automatically format the links in Org format.

Jeremy Friesen decided to do something about this. He wrote a surprisingly simple function that allows you to call org-store-link directly from within Elfeed. The generated link will be to the target URL not the RSS entry so it’s ideal for generating a link to the actual content.

If you use Elfeed to collect and curate interesting content and often—or even sometimes—want to save a link to the content in an Org file, Friesen’s solution is just what you need. The post is short and the code is minimal so you should definitely take a look.

Posted in General | Tagged | Leave a comment

Emacs Registers

Over at the Emacs subreddit, kosakgroove has just learned about Emacs registers and considers it a game changer. His post is little more than a headline so all the action is in the comments. Surprisingly—at least to me—many of the commenters were unaware that registers even existed.

For me, registers are useful in two situations:

  1. I want to save my current window configuration so that I can run some function—eshell, for example—in full screen, and reinstate my previous window configuration when I’m done.
  2. Saving values or counters in keyboard macros.

For example, here’s how I run eshell:

(global-set-key (kbd "H-e")
                (lambda (exit)
                  "Bring up a full-screen eshell or restore previous config.
With a prefix argument, exit eshell before restoring previous config."
                  (interactive "P")
                  (if (string= "eshell-mode" major-mode)
                      (progn
                        (when exit
                          (insert "exit")
                          (eshell-send-input))
                        (jump-to-register :eshell-fullscreen))
                    (progn
                      (window-configuration-to-register :eshell-fullscreen)
                      (eshell)
                      (delete-other-windows)))))

The important thing to notice in this example is the use of :eshell-fullscreen as the register key. That’s a trick I learned from Magnar Sveen. In interactive use, the key has to be a single character but because of an implementation artifact, any symbol will do from within Elisp. That’s nice because you don’t have to worry about having a user write something over your saved window configuration. I use this same trick a lot in my init.el.

Here’s an example of using a counter register in a keyboard macro. Both of these example are a bit specialized. You can simply save some text or a position in a register and insert it later when needed. Registers really are an almost magical power and it pays to get familiar with them.

Posted in General | Tagged | Leave a comment

Marlinspike On What’s Wrong With Software Development

Moxie Marlinspike is a legendary figure in security and software development. I last wrote about him and his fight to keep our data safe from governments and other prying eyes 9 years ago. He’s still at it.

At the recent Black Hat Conference, Marlinspike took a few minutes to give his views on the state of software development. He blames its current deplorable conditions on Agile but what he really means is layers and layers of abstraction that prevent the developer from understanding what is really happening with their software.

His message really resonated with me. I have long thought the same, at least about the layers of abstraction (I have no experience with Agile). You see this dynamic with MIT abandoning their famed SICP course in favor of teaching about using libraries to control robots or something. My problem with that—putting aside the offense of getting rid of SICP—is that students aren’t learning the fundamentals of computer science and what the machine’s really doing.

I addressed this same issue in my Is C Useful For Understanding How Computers Work. If you only know how to use high level languages and libraries that are black boxes to you, you will never understanding what’s really going on with your software.

The difficulty is that our corporate industry leaders love this stuff because it enables them to produce loads of software faster and easier. The problem is that no one, including the developers, really understand what it’s doing. The result is exploit after exploit. And, as Marlinspike says, a lack of joy on the part of those writing the software.

Posted in General | Tagged | Leave a comment

WordStar

Those of us of a certain age will remember WordStar. It was the first hugely popular “word processor” and was used by almost everyone who wanted to write prose of any sort. It was the default word processor in the MS-DOS world and perhaps even for CP/M. It was mostly replaced by Word Perfect and Microsoft Word and faded into obscurity. I used it for a long time and wrote several articles with it.

Although those days are long gone and my memory is dim, I’m pretty sure that writing in Org mode is better. You have the same formatting that WordStar provided and you don’t have to worry about its proprietary file format.

Still, it lives on as the preferred writing platform for writers such as George RR Martin and Robert J Sawyer. I’m pretty sure that Martin continues to use MS-DOS just so he can have WordStar—that’s real devotion to an app.

Sawyer, on the other hand, isn’t giving up on WordStar but would like to live in the modern world. He has resurrected WordStar to run on modern systems albeit with a DOS emulator. That’s a road too far for most of us, of course.

But why go there? Professional writers are notoriously crabby about their writing platform. They want whatever they’re used to and don’t ever want to change. I love the process of writing in Org but professional writers don’t want to think about their platforms: they just want to write without thinking about the software they’re using.

That’s too bad because

  1. Emacs/Org mode has a clean, easy to learn interface, and
  2. Emacs is not going to be abandonware like WordStar. It’s going to be around for the foreseeable future.

Of course, some mainstream writers such as the recently deceased Vernor Vinge do use Emacs so perhaps others will join in.

Posted in General | Tagged , , | Leave a comment

Why Isn’t Lisp Used More In Production

nderstand2grow, over at the Lisp subreddit extols the benefits of the Lisp languages and wonders why it isn’t more widely used in production. It’s a question that all Lispers eventually ask themselves. Despite what people who don’t know Lisp tell you, it really is a better language that provides programmers with virtually unlimited flexibility.

There are a lot of suggested answers in the comments most of which have something useful to say. I subscribe to the cynical answer that other, lesser, languages won in the market place for the same sorts of reasons that VHS won over the technically superior Betamx.

I suppose the AI Winter also helped sink Lisp. It’s too bad. It really is a great language that is much better than its competitors. It’s too bad hardly anyone recognizes that.

Posted in General | Tagged | Leave a comment

Opening Links In Emacs

Nicolas Martyanoff has a really interesting post on Controlling link opening in Emacs. One of the things I like about Org mode is that you can put the point on a URL, type Ctrl+c Ctrl+o and Org will follow the link. You can also use Meta+o to choose any visible link in the buffer in an Avy-like way.

Sadly, this behavior is specific to Org and not implemented in other modes. Some modes do have a way of following links but there’s no standard method. But this is Emacs so Martyanoff decided to fix that.

It’s not as hard as you might think because all the methods end up calling browse-url so mostly what you have to do is set things up for the particular mode you’re in and call browse-url. Martyanoff shows how to do this for several modes as well as providing a way to choose between EWW and Firefox. He has several Firefox profiles so his code also provides a way to choose which profile to use for a given link.

He’s got all the code in his post so head other there if you’re interested. Even if you’re not interested in replicating his code, it’s worth remembering that you can always just put the point on the URL and call browse-url-at-point directly.

Posted in General | Leave a comment

Asking For Confirmation

Marcin Borkowski (mbork) has a really great post about arranging for certain commands to prompt for verification before executing. Usually, those prompts are simply annoying but sometimes they’re actually useful. For example, you can arrange for Emacs to ask you for confirmation before exiting. Normally that would be really annoying but after I accidentally exited Emacs several times by fat fingering some shortcut, I began to appreciate its usefulness.

Some, dangerous, commands always prompt for approval. Others, like kill-emacs don’t ask for approval by default but can be configured to do so to help those like me who are prone to fat fingering. But, of course, most commands don’t ask for confirmation and don’t have a configuration option to enable it.

Mbork gives an example of a command where he wanted approval before it executed. I have another: Several times I fat fingered the command to print the current buffer—which always seemed to send my printer into a schizophrenic fit—and finally decided to do something about it. But what?

Mbork has two suggestions. He first thought about advising the function he wanted to protect—that’s what I did with print buffer—but then it occurred to him there was a builtin solution. He realized that he could simply mark the function in question as disabled and Emacs would automatically prompt before executing it. Even better, you can also specify what the prompt will be.

But wait! There’s more. While researching that solution he discovered the command command-query that does exactly what he wanted. You can check out his post for the details but the TL;DR is that if you want a prompt before executing a given command, command-query is the solution.

Posted in General | Tagged | Leave a comment