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

Making Things Easier

A family member and I were having an argument a discussion about the relative ease of using a MacBook Pro with macOS and a Lenovo laptop with Linux. A lot of you guys are thinking, “Yeah, I’m with the Linux guy!” but before you choose sides you should know that he has been seduced by the dark side and is a Vim user1.

Anyway, the discussion evolved into how you would put a link to a Web page open in your browser into an email. My family member said he would double click on the URL bar of the browser, switch to his email, and middle click to insert the link. I replied that I don’t even have a middle button but that I don’t need one because I’m an Emacs user and had written a bit of Elisp to automatically insert the URL of the browser’s currently active page. Thus I merely started writing my email and when I got to the place that needed the link, I just called my Elisp.

That bit of Elisp is a function called jcs-insert-url but I said that the most I ever had to type was Meta+x j i u and often I only needed part of it depending on how autocompletion was feeling at the time. I added that I could, of course, add a key binding like Hyper+u to call the function and make the whole process even easier. Then I started wondering why I hadn’t done that. I keep on typing Meta+x j i u whenever I want to insert a URL. That’s crazy. So I added the binding and now my life is even easier.

The point of this post—finally—is a reminder to myself and to you to occasionally think about your workflow and ask if there’s some adjustment that would make things easier. It’s amazing how often the answer is yes.

Footnotes:

1

I’m just trash talking. Regular readers know I was a Vi/Vim user for many years, still think highly of it, and consider it one of the two best editors for serious programmers.

Posted in General | Tagged | 11 Comments

Language/Editor Integration

In yesterday’s post, I discussed Karl Voit’s love letter to Org mode and how he’s come to depend on it for personal information management. Articles about Org mode almost always make the point that Org documents are plain text and can be edited with any editor. That’s true and it’s part of what gives Org its power.

On the other hand, just because you can edit Org mode documents with any editor doesn’t mean you should or would. Who, other than in an emergency, would do such a thing1? One reason not to do so is, of course, that Org mode runs in the Emacs lisp interpreter so you can’t get agendas, generate reports, use the spreadsheet functionality, or a host of other things in other editors.

A more subtle reason, though, is that the Org language is integrated with the Emacs editor. Alex Beal explores this integration in an interesting post over at his blog usr/bin/blog. The way you deal with Org structures and operate on the data is deeply integrated into Emacs. One of the examples he gives is editing tables. You can, of course, build an Org table in any editor but the Emacs editor will automatically format them for you and allow operations such as adding, deleting, or moving rows or columns in an easy way.

Beal argues that this integration is very valuable and is something missing in most languages. Emacs does, of course, provide minor modes that do some of this integration but not as much as with Org mode. It’s an interesting and thoughtful post that’s worth reading.

Footnotes:

1

Leaving aside the possibility of programmatically generating such a file, of course.

Posted in General | Tagged , | 1 Comment

Karl Voit on Org Mode

Karl Voit has a lovely paean to Org mode in which he recounts his journey to Org in a years-long quest to organize his life and maintain a knowledge database. I’m sympathetic. I started with a Rolodex and a pocket full of index cards. Years later I find myself, like Voit, spending the majority of my tube time in Org mode.

Voit is an expert on personal information managers and has spend a considerable amount of time building up his work environment. He suggests an often proffered but frequently ignored piece of advice for using Org mode: start off with one or two simple functions—note taking, say—and add more functionality as the need arrives. Bernt Hansen’s excellent Org Mode – Organize Your Life In Plain Text! is an excellent place to see what Org can do. It’s short enough the read the whole thing but comprehensive enough to show you what’s possible and to serve as a go-by for implementing your own workflow.

As Voit says, one of the major benefits of Org—besides its power—is that the data format is plain text. You can, if you like or need to for some reason, write an Org document with any editor, even echo if it comes to that. That’s a huge advantage because it means you don’t have to worry about being locked into proprietary data formats that might stop being supported sometime in the future. That’s one of the main reasons I feel comfortable living in the Apple ecosystem: all my data (other than specialized data such as pictures and PDFs, which are also in open source formats) are plain text so if I have to leave Apple for some reason, I can take all my data with me. I largely have Org to thank for this.

If you’re an Org user or wondering if you should be, take a look at Voit’s post. It’s an interesting read.

Posted in General | Tagged , | Leave a comment

How Do I Exit Vi?

As I’m sure all of you know, there’s a meme going around about people not being able to figure out how to exit Vi/Vim. I haven’t joined in the fun because, after all, exiting Emacs is just as obscure. Nevertheless, you have to love this story:

It’s another one of those anecdotes that’s too good not to be true but I have to admit to a certain skepticism. Still, it’s an amusing tale even if its provenance is questionable.

Via rjzii

Posted in General | Tagged , | 1 Comment

Comparing Doom Emacs, Spacemacs, and Vanilla Emacs

Yiming Chen has an interesting post that compares Doom Emacs, Spacemacs, and vanilla (i.e out-of-the-box GNU-) Emacs. Chen approaches the subject from the point of view of a Vim immigrant who is heavily invested in the Vim keystrokes and mindset.

Until very recently, I hadn’t even heard of Doom Emacs but it looks to be an excellent configuration for someone who wants to live in the Vim environment as much as possible while still using Emacs. The other choices offer similar functionality to the Vim user. You might wonder why anyone would bother. If you’re most comfortable in the Vim environment, then use Vim. The most common reason you see is to get access to Org mode and that’s certainly a good enough one. Doubtless there are others.

Those who want the Vim experience in Emacs have at least the three choices that Chen explores. If you, too, want a Vim experience from Emacs, take a look at Chen’s post. He gives the pros and cons of each choice as he sees it. You’ll have to follow the link to see which one he chose but it’s worth the read in any event. Even if you aren’t looking to bring Vim with you.

Posted in General | Tagged | 2 Comments

Debugging Elfeed with DTrace

If you don’t follow Chris Wellons over at nullprogram.com, you really should. Wellons always has interesting posts, and often discusses fascinating technical details. He’s shown me how to do things that I didn’t know Emacs could do like rendering fractals. His posts on the Elfeed DSL implementation and working with Emacs strings are brilliant and every Elisp programmer should study them.

A while back, he got a bug report about Elfeed occasionally failing. The bug was not reproducible and Wellons couldn’t get it to happen on his machine at all. I’ve also never experienced it so it’s not common. That makes it particularly hard to debug.

Wellons knew that the problem was somewhere between Curl, which takes care of downloading the RSS XML, and Elfeed. It could be in Curl, in Emacs, or in Elfeed itself. Wellons realized pretty quickly that what he needed was DTrace but that’s not available on Linux, which he uses, so he decided to install FreeBSD on a Raspberry Pi that he had sitting around and do his debugging there. Serendipitously, that had the added benefit that it caused to bug fire reasonably reliability. Using DTrace, he was able to discover what was happening. Be sure to follow the link and discover what that was and see the details of his debugging. One of the unexpected benefits of his fix that affects us all is that Elfeed is now much faster. I saw a dramatic increase in the speed of Elfeed’s RSS downloading. Until I read his post, I didn’t know what had happened.

This is a great post and I learned some new things from it. You probably will too so it’s definitely worth your while.

Update [2018-01-25 Thu 13:03]: Insert missing comma so the sentence makes sense.

Posted in General | Tagged , | Leave a comment