Fifteen Days with Dired

Ramit Mittal is a new Spacemacs user who decided that for 15 days he would use Dired for all his file operations. That’s not hard to do. I don’t always use Dired but it’s usually easier than bringing up or switching to a terminal to do it by hand. Especially since if I need to do a file operation, I am almost certainly in Emacs anyway.

For most operations, Dired provides the advantages of doing an ls followed by whatever file operation you need. In fact, it’s better because you can search for the file you want to operate on by typing the first few letters.

Mittal’s post demonstrates some of the ways he learned to use Dired to make his workflow easier. He mentions, for example, that when you open a terminal while in a Dired buffer, the terminal will open in the same directory as the buffer.

He also mentions using xdg-open to open a file in its default application. That works in Linux; for macOS, you would use open. Although he doesn’t mention it, you can also map xdg-open or open to the be the default action for the ! and & commands.

I don’t know for sure but my impression is that Dired is an underused feature of Emacs. It’s really powerful and useful and very much worth taking a bit of times to learn. It also helps to bookmark its refcard so you can bring it up if you forget one of its many commands. In any event, Mittal’s post is short and worth spending a couple of minutes to read.

Posted in General | Tagged | Leave a comment

Law Enforcement Pirates

If you’re an American, the government can’t take your stuff without a legal finding of wrongdoing on your part. That’s what most Americans believe but they’re wrong. The government can, and does, confiscate citizens’ property without legal proceedings or even an allegation of wrongdoing.

I wrote about this a couple of weeks ago in my The TSA: Keeping Us Safe From Cash post. This sort of thing even has a name: asset forfeiture. A better, more accurate name, is piracy. You’d think it would be rare but according to the Washington Post it’s anything but:

Just think about that. The government is stealing more from Americans than burglars do.
The original intent was to prevent criminals from profiting from their crimes but has since morphed into a way for law enforcement agencies to fund their operations. The situation is so out of control that many states are passing legislation outlawing the practice and groups like the Institute for Justice have filed (and won) several cases on behalf of the victims. Real justice would be seizing the budgets of those agencies as the proceeds of criminal activity. That won’t happen, of course, but at least we can hope that state legislators and the courts will put an end to this reprehensible practice.

Posted in General | Tagged | Leave a comment

Switching to Emacs

Protesilaos Stavrou has an interesting video that boils down to a lecture on the morality of free software in general and Emacs in particular. He frames the lecture in terms of his journey from a complete computer neophyte to the accomplished programmer and user that he is today (although he modestly resists that label).

The whole video is worthwhile but the part I want to write about is his thoughts about Emacs and what he learned when he switched to it from proprietary software. The first thing he learned is that Emacs will not magically make you more productive. You have to commit to learning it and put in the time to master it. As Stavrou puts it, you can’t be an Emacs tourist. You won’t learn Emacs in a weekend, a month, or, as some of have discovered, even years. It’s a long term commitment. That doesn’t mean that it will be years before you can be productive; only that mastery takes more than a weekend.

Part of that commitment to learning Emacs involves reading the documentation. Stavrou claims that there’s no substitute. No blog post or quick video is going to tell you everything you need to know. You must read the documentation.

All of this was interesting to me because I believe—and have written—the same thing. The usual reaction is “That’s why Emacs is doomed and deserves to be.” Sorry, but I’m unrepentant: Like anything else worthwhile, mastering Emacs takes effort and commitment. Don’t expect to be up and running in a couple of days.

Posted in General | Tagged | Leave a comment

Useful Emacs and Org-mode Features

Karl Voit gave an excellent talk at Grazer Linuxtage 2021 on some Org Mode features that you may not know. The talk also covered some Emacs features that he uses to enhance his workflow. He has an outline of the talk on his website so you needn’t worry about trying to take notes or writing down any shortcuts that you don’t already know.

Experienced Emacsers probably already know a lot of the things he covers but I learned a couple of new things so it’s definitely worth watching. The first new—or perhaps, forgotten—thing that I learned about was scroll-lock-mode. It’s not something I would use everyday, but sometime it’s just what I want. It’s an easy way to read a document without have a scroll page by page. Voit maps it to the scroll lock key which, if you have one, is a handy way of activating it.

Sort of related to scroll-lock-mode is view-mode, which makes the buffer read only and lets you scroll up and down by the page or half page using Space, Delete, d, and u. You can also search with s.

Next, he demonstrates various ways of entering and changing time stamps including using the relative timer for note taking during a meeting or video. He also discusses using the :crypt: tags to encrypt a node in an Org tree and doing a regex search using sparse trees.

The final part of the talk are some customizations mostly using packages. These include his really powerful use of hydras and his use of the eyebrowse package to organize his Emacs work spaces.

The talk is just short of 41 minutes but it moves quickly and is very enjoyable. Highly recommended.

Posted in General | Tagged , | Leave a comment

Writing Technical Documents with Org Mode

alpha2phi has a nice post on writing documentation with Emacs and Org-mode. The post is reminiscent of Mike Hamrick’s video on keeping technical documents consistent and uses some of the same techniques.

Alpha2phi starts with importing Fabrice Niessen’s excellent ReadTheOrg theme for exporting (to HTML) Org documents. Like Hamrick, he imports a separate file with useful utility functions, including an initialization function that is called from the document’s header.

Finally, he shows how you can call a function to interpolate a value or some text in the body of the document.

This post is a nice complement to Hamrick’s video. If you prefer to read the material rather than watch a video of it, take a look at this post. The material is very useful for anyone writing documentation.

Posted in General | Tagged , | Leave a comment

Walmart and Apple Pay: What COVID-19 Taught Me

Everyday, I check the status of two items:

  1. Has the State of Florida finally rolled out their promised digital driver license program?
  2. Has Walmart finally accepted the inevitable and started accepting Apple Pay?

So far, no joy but the two items aren’t really the same. Florida has committed to digital driver’s licenses and although they’re proceding slower than I’d like, I’m sure they’re working through the problems to get to program running.

Walmart is just being stubborn. For years they used their commitment and obligations to the still-born CurrentC consortium as the reason they couldn’t accept Apple Pay. With the disintegration of CurrentC (in 2016) that excuse evaporated but Walmart still won’t enable Apple Pay. The reason, of course, is what it always was: Walmart wants to harvest their customers’ data for targeted advertising and Apple Pay specifically prevents that.

Before the pandemic, I frequently shopped at Walmart because they were convenient and had very competitive prices. When COVID-19 took hold, I started avoiding going into crowded, closed spaces like Walmart stores but I still needed the supplies I used to get there. What I discovered is that Amazon will happily deliver all the things I used to get at Walmart to my door for comparable prices. Really, there’s no reason to go to Walmart during or after the pandemic.

So here’s the deal Walmart: start putting your customers first by—among other things—enabling Apple Pay or lose at least one customer for good. I know you won’t miss me but what if there are others like me out there?

Posted in General | Tagged | Leave a comment

Red Meat Friday: Journalists (Again)

Okay, one more swipe at journalists and then Red Meat Friday will move on. Unless, of course, the Minions force my hand.

From time to time I’ve had some harsh words about the moral and work ethic failings of journalists but perhaps they can’t help it:

As amusing as this is, it probably falls into the category of what journalists call “too good to check.” You can see the details in the Insider Article but the whole thing strikes me as less than rigorous. Still, read it and make up your own mind. In the mean time, enjoy this Friday’s red meat.

Posted in General | Tagged | Leave a comment

Reasons for Clojure

Irreal regulars know that I’ve been exceedingly wishy-washy about learning Clojure. Every time I see a video from Zamansky or someone else using it, I get excited about learning and trying it out. Other times, I get hung up on its running on the JVM and the deviation of its syntax that I’m used to from that of Common Lisp and Scheme.

I was looking through my list of blog post ideas and came across this old piece by Brian Sunter on why he thinks Clojure is a language worth learning. Many of those reasons are common to all Lisps but others are unique to Clojure.

Some of the things I like are support for Go-type channels, very strong interactive programming support, and support for destructuring and pattern matching. But the thing I like the most is something that Sunter doesn’t mention: Clojure—more than Common Lisp or Scheme—has a reasonable claim on being or becoming a mainstream programming language. That’s important because if you want to be a Lisper it’s really hard to find a job using Scheme or Common Lisp. It may be that Clojure offers those who want to do Lisp professionally a chance to do so. I’m not sure we’re there yet but it’s a least possible that Clojure will gain enough traction to be seen as a reasonable choice for projects. Why not? Plenty are people are using Java and, let’s face it, Clojure is a much better language.

Posted in General, Programming | Tagged | Leave a comment

Emacs Diary and Calendar

Protesilaos Stavrou has posted another of his excellent videos on Emacs. This time it’s about the Emacs Diary and Calendar operations and how they work together. It turns out that the diary and the calendar are tightly integrated and work together to provide a particularly nice workflow.

If you use the diary feature, you should definitely watch Stavrou’s video. There are lots of features involving the calendar that you may not know about. The same advice applies if you’re looking for a simple reminder list. Even though Stavrou doesn’t use the diary as a diary, his video shows you how to use it that way too.

As Stavrou notes, you can do all this in Org mode as I and many others do. Stavrou, though, wants a simple system to remind him of upcoming tasks and doesn’t need or want the extra functionality that Org offers for this particular job.

As usual, Stavrou has tweaked things to better fit his needs. For example, he’s added a bit of Elisp to to send him an email every morning with the day’s events. He also configured the diary is give him a warning \(X\) minutes before an event.

He’s built a nice system that works well for him and probably others but I’m already doing all this in Org-mode and don’t intend to change. If I were just starting, though I would give it some serious thought. Likewise, if I ever decide to keep a diary—in the sense of today’s thoughts and observations—I’d almost certainly use the diary for that.

Posted in General | Tagged | Leave a comment

Deactivate Mark

If you’re like me, you probably don’t think very much about activating and deactivating the mark. We know it gets set when we do a large movement or when we set it manually with Ctrl+Space. We know that the current region is defined by the point and mark and maybe even that we can jump to a whole list of current and previous marks.

Leave it to Marcin Borkowski (mbork), who’s an expert at teasing out Emacs minutia, to discover and explain some of the mystery surrounding the deactivation of the mark. It turns out that there’s both a function and variable named deactive-mark. The function does just what it says on the tin: if you call it, the mark is deactivated.

The use of the variable is a little more complicated. The TL;DR is that Emacs has its own notions about when to deactivate the mark and that this is mediated through the deactivate-mark variable. Being Emacs, a user can, of course, change Emacs’ default ideas of mark deactivation. You can read all the details in mbork’s post.

The truth is that you’ll probably never need to fine tune Emacs’ mark activation/deactivation but if you’re writing a function that depends on the current mark being maintained, you should definitely take a look at mbork’s posts to learn how to avoid having Emacs change it out from under you.

Update [2021-04-14 Wed 18:04]: Added link to mbork’s post.

Posted in General | Tagged | Leave a comment