Working with Gists in Emacs

Bill Ward has a handy post on how to manage and create Gists with Emacs. It mostly involves installing gist.el and its dependencies. After the installation, you can easily edit existing Gists or create a new one.

If you publish code or other snippets as Gists, this may be a timesaver for you. It’s a short post so there’s no reason not to give it a read.

Posted in General | Tagged | Leave a comment

The Advantages of Blogging for an Emacs User

I, and many others, have written thousands of words about the advantages of using Emacs for blogging. In my case, I could, if I wanted, publish Irreal and virtually never visit the site itself; I can do everything from Emacs. I’ve been blogging at the two incarnations of Irreal for 9 years and would have quit long ago if Emacs didn’t make it so easy and enjoyable.

But today, I want to turn that on its head and say a few words about how blogging has helped me become a more effective Emacs user. It’s not just typing over 600,000 words into Emacs—although that helps, of course. It’s more about what I’ve learned regarding Emacs from blogging.

The first, and most valuable, benefit is what I learn from my readers. Sometimes it’s a matter of asking a question and getting informed answers. More often, though, I write about some aspect of Emacs use and readers help me flesh out my understanding by providing new details and interpretations that I hadn’t considered.

The second advantage is that because I spend a lot of time working on the blog, I’m always looking for and implementing micro-optimization’s to make it easier. Once I’ve written some Elisp to make blogging easier, it’s available for use in other tasks too.

An example of this is the jcs-insert-url function that I wrote about last week. I originally wrote the function to make some blogging task a bit easier but now I use it all the time for adding Web links to emails and other documents. This is typical. Almost everything I do to make blogging easier ends up helping ease other tasks as well.

So the takeaway is that if you want to get better at Emacs, using it for blogging is an excellent way. It’s certainly worked for me.

Posted in General | Tagged | 2 Comments

Mu 1.0 Problem Solved

In yesterday’s post, I wrote that I had installed the new version of mu/mu4e but that the inbox and searches were showing some deleted messages as well as the ones I was looking for. I was gearing up to dive into the code when I noticed that the “extra” messages appeared to be from the same threads as the unread ones. Once I realized that, it was easy to figure out what was going on. A little RTFM brought me to §7.4.3 of the user manual where I learned about the option mu4e-headers-include-related that controls whether related messages (those from the same thread) are also shown. Apparently the default value was changed from nil to t in version 1.0.

I can see where that might be a useful default for some workflows but it’s a disaster for mine. After a bit of thought, I realized that that’s because I get three types of email messages:

  1. Those from the clueful who use the interleaved posting style;
  2. Those from the non-clueful who reply at the top and let their MUA add the original email at the bottom;
  3. Emails from mailing lists.

The first two types always provide any missing context so I don’t need to worry about threads and I always the delete the third after reading them—they’re in the list archives if I need them—so most of the thread comprises deleted emails. That’s why I was seeing a bunch of deleted emails in my inbox. They were from the thread of the current email from a mailing list.

Now that I know the option exists, I can see where I might occasionally find it useful. Happily, the developers have me covered. All I need do is type W in the headers view to toggle it on or off.

One final note: if you like the option and leave it on you should use ] and [ to move to the next and previous unread message rather than n and p. There’s all sorts of useful keybindings for the headers view that you’ve probably forgotten about since you first skimmed the manual. It’s worth taking another look at them.

So the TL;DR is that the “problem” was indeed as configuration issue and after the appropriate adjustment I’m back to enjoying mu4e just as I always have.

Posted in General | Tagged | 3 Comments

Mu 1.0

Good news for all you mu/mu4e users:

I’ve really been looking forward to the “format equals flow” support in the mail reader so of course I downloaded and installed it right away. If you’re a Mac user, the 1.0 version has not yet reached the Homebrew distribution but if you’re compiling it yourself, it’s just a matter of the usual configure, make, sudo make install dance. It worked without problem for me on macOS and will, I’m sure, be just as easy on Linux. Once you’ve installed the new software, be sure to do a

mu index --rebuild

to update your index.

Except for one problem, everything is working flawlessly. The problem is that when I open the inbox or even search for, say, new and unread messages, I get several already deleted messages listed as well. If I do the search manually with

mu find flag:new flag:unread

I get the correct messages listed.

I’m guessing that this is some problem with my configuration because I don’t see how even a minimal check—let alone the three 1.0 alpha releases that the developers made—could miss something like this. I haven’t had any time to devote to tracking down the problem yet so I don’t know what’s going on. If you’re seeing the same thing, please leave a comment so that I don’t waste time bebugging my configuration and so I can let the developers know.

Posted in General | Tagged | 4 Comments

Another Take on Engineering Notebooks

As regular readers know, I’m a big fan of keeping an engineering notebook. I have an Org file named journal.org that most of my day-to-day notes go into but for larger, sustained projects I like to start a dedicated project notebook.

As a result, I’m always interested in how others go about organizing and maintaining their engineering notebooks. Dan Kleiman has an interesting post on his procedures for keeping an engineering notebook. Kleiman uses a completely generic method for his notebooks so his process may interest those of you who aren’t Emacs/Org users.

As I read Kleiman’s post, I kept mentally translating each step into the equivalent Org method. I’m sure those using other tools can easily do the same so Kleiman’s post can be useful for a wide range of users. The main takeaway, for me at least, is that your tools and specific procedures are not as important as organizing your data and scripts and keeping careful notes on what problem you’re trying to solve and the steps you’ve taken to solve it.

The post is relatively short so it’s easy and well worth your time to give it a read.

Posted in General | Tagged , | 2 Comments

The Suit That Would Not Die

It’s very possible that some of Irreal’s younger readers won’t even know what this is about. Older readers will just shake their heads like I did and think, “I thought that was over years ago.” But it isn’t.

Sadly, The SCO/IBM suit lumbers on like a zombie. Just like it has for the last 15 years. Fifteen years! I started to read through the opinion but found I couldn’t bear to go through it all again. When it started, SCO was claiming that it owned the rights to Linux and was demanding license fees from Linux users. A few companies, having scored low in the genetic lottery sweepstakes, actually paid up. Most told SCO to go pound sand and the user community pretty much shunned those who had capitulated. When (we thought) it ended, the District Court had ruled against SCO on pretty much every point.

Now the Court of Appeals has overturned the District Court on one of the key points. From what I can tell from the parts of the opinion that I did read, the ruling hinges on a technical point and does not speak to the merits of SCO’s claim.

I just wish someone would put a stake through SCO’s heart and end this nonsense once and for all. The suit, like the zombie it resembles, is threatening to eat our brains and no sane person wants to live through the drama again.

Posted in General | Tagged | Leave a comment

Privacy Finally Wins One

An appeals court in the UK has declared the UK Investigatory Powers Act 2016 (the so-called Snooper’s Charter) illegal. The judges ruled that the law provided insufficient safeguards. As you’d expect, the government trotted out the usual specter of the Four Horsemen of the Infocalypse featuring, of course, child pornography.

Doubtless the government will make whatever minimal changes are required to satisfy the judges so that they can get back to spying on their citizens. Still, this is encouraging news of the sort too seldom heard.

I wish the courts here in the U.S. would show similar gumption. One thing for sure: we can’t depend on Congress to protect us from these snoops. As a result, we have a secret court issuing rulings that—if current news is to be believed—were obtained by the FBI’s withholding of information from the court.

Maybe next time.

Posted in General | Tagged | Leave a comment

Abo-abo

Oleh Krehel (abo-abo) is the author of many outstanding packages including the essential Ivy/Swiper/Counsel suite that revolutionizes searching. A few years ago, I wrote that when I get tired of blogging I was going to gin up some Elisp to make a post everyday that says, “Abo-abo has a great post today. Go read it.” I meant that as a tribute to his prodigious productivity but it was really a whimsical remark.

Maybe it wasn’t all that whimsical. Today, Boxingshmoxing notes that Abo-abo hasn’t gone a day without committing to GitHub in over 3 years. That’s astounding and an indicator of how much abo-abo has contributed to the Emacs community. It turns out that abo-abo has a Patreon Page and is trying to get sufficient backing to allow him to dedicate one day a week to his open source projects. This is very worthwhile and I encourage anyone who can—or can strong-arm their employer—to support his efforts. He’s more than earned it.

Posted in General | Tagged | 1 Comment

Zamansky 40: Atomic Chrome

Mike Zamansky has the latest video in his Using Emacs series up. This time it’s about using Emacs with Chrome via Atomic Chrome. Guys like Zamansky and me like to stay in Emacs as much as possible and—at least in my case—resent having to edit text without it.

If you’re a Chrome user, Atomic Chrome is a nice solution. When you’re in a browser text area, you can hot-key (or push a button) to bring up an Emacs buffer to write and edit your text. That’s very nice because then you have access to all your Emacs shortcuts and completions.

Sadly, there’s nothing similar for Safari, my browser of choice. I think this has to do with the Safari architecture but perhaps it’s just that no one has bothered writing one. Life on macOS is made a little easier by being able to use Emacs keybindings across the entire system but it’s not the same because you’re not really in Emacs and don’t have access to all those shortcuts and optimizations you have in Emacs.

If you use Chrome and Emacs, you should definitely take a look at Zamansky’s video. It’s just over 6 and a half minutes so it should be easy to find the time.

Posted in General | Tagged | Leave a comment

More Making Things Easier

Responding to yesterday’s post, Sacha asks if I could post the code for jcs-insert-url for others to use. I thought I’d already done that but apparently not. That’s probably because except for the part identical to jcs-get-link, which I did write about, it’s pretty trivial. In any event, here it is:

(defun jcs-insert-url ()
  "Insert URL of current browser page into Emacs buffer."
  (interactive)
  (insert (jcs-retrieve-url)))

The jcs-retrieve-url function does all the work, of course, and is just the code that I abstracted out of jcs-get-link to actually retrieve the URL from Safari:

(defun jcs-retrieve-url ()
  "Retrieve the URL of the current Safari page as a string."
  (org-trim (shell-command-to-string
    "osascript -e 'tell application \"Safari\" to return URL of document 1'")))

One obvious problem with all this is that it works only for macOS. Not to despair, though, because in the comments to the original post, Brad Collins suggests a solution that uses grab-x-link to do the same thing for FireFox and Chrome on other systems. Be sure to read Brad’s comment because there is—or at least was—an issue with the MELPA version.

Finally, Sacha took the part about looking for ways to make your workflow easier seriously and came up with a bit of Elisp to insert a function definition at the point, regardless of where it’s defined. That’s very handy and I immediately stole her code and used it to insert the two functions above. My old method was to switch to init.el, find the function, copy it to the kill ring, switch back to the original buffer, add the source block fences, and insert the code between them. Sacha’s code did all of that for me and I didn’t even have to leave my current buffer. That’s splendid. If you find yourself having to add function definitions to your text, be sure to read Sacha’s post. It will save you a lot of time.

Posted in General | Tagged | Leave a comment