Dumb-jump in Action

The other day I wrote that I was considering installing dumb-jump and giving it a try. I did that and have been using it since I watched Mike Zamansky’s video on Projectile and Dumb-jump. It really is the sweet spot for me. I never liked TAG files and their associated machinery but dumb-jump doesn’t require any of that: it just works.

Recently, AT&T graciously released the source code for Research Unix v.8, v.9, and v.10. That’s a boon for us Unix aficionados who like to read code. I downloaded v.10 and started browsing. This is the first time I’ve had access to the source code for a modern AT&T Unix so I’m not familiar with the files layout. Fortunately, dumb-jump is just what I needed. All the kernel source files are in the sys directory so I put an empty .dumbjump file in sys and now when I’m looking at a function and it calls some other function in a different file, I can jump directly to it and then return.

I added two additional keybindings to the ones recommended in the README. For those who are interested, here is my configuration:

(use-package dumb-jump
  :ensure t
  :bind (("M-g o" . dumb-jump-go-other-window)
         ("M-g j" . dumb-jump-go)
         ("M-g b" . dumb-jump-back)
         ("M-g q" . dumb-jump-quick-look)
         ("M-g x" . dumb-jump-go-prefer-external)
         ("M-g z" . dumb-jump-go-prefer-external-other-window))
  :config (setq dumb-jump-selector 'ivy))

You really want a binding to return to your jumping off place so I added that. I also added a binding for dumb-jump-quick-look, which gives you a short popup of the definition and some context.

The Unix kernel isn’t the largest project by any means but it is good sized. Nevertheless, dumb-jump found and moved to the target file almost instantaneously. I really like this package a lot.

Posted in General | Tagged | Leave a comment

Org 9.0.7

Org mode has a bug fix out. I track Org on Melpa but if you don’t, now is a good time to update. If you do track Org on Melpa, the new version is there and ready for update.

Posted in General | Tagged , | Leave a comment

If You’re Looking for Another Reason to Despise Journalists…

Here you go.

Posted in General | Tagged , | Leave a comment

The Past Comes Due

Irreal oldtimers know that I have often railed about the activities of the NSA and their domestic spying and about the ever more shrill demands by law enforcement that they be given a back door into our cell phones. As everyone knows by now, the government’s sins have caught up with them.

Here are a couple of tweets from Edward Snowden that illustrate the problem

The NSA developed an exploit for Microsoft Windows and then lost control of the code, which was subsequently published on the Web. Criminals, of course, immediately used it to develop a ransomware worm which, among many other things, shut down several hospitals in the UK. I haven’t yet heard of any deaths resulting from this but it’s probably just a matter of time. In any event, it appears patient records may have been lost.

The US was largely spared but only because a UK security researcher stumbled on a kill switch for the malware and stopped it from spreading. You can read that amazing story in the link from the first tweet. Sadly, it appears that a new version without the kill switch has appeared.

I don’t believe it’s the slightest bit unreasonable to hold the NSA responsible for this mess—including any deaths that result. They wrote the exploit, they didn’t inform Microsoft of the vulnerability that made it possible, and then they let it get stolen. Someone should, at a minimum, lose their job but, of course, no one will.

That brings me to the second point. The government insists it can be trusted with a “golden key” to our smart phones and other devices. They say that of course they won’t abuse the capability and that we can trust them to keep the key out of the hands of criminals and hostile nation states. The WannaCry incident puts the lie to both those claims and justifies my belief that we should never trust the government with the access they desire.

Charlie Stross has an hilarious piece on the incident. He makes the point that if what happened were submitted as a piece of fiction, it would be rejected as unbelievable. He’s got a point.

UPDATE [2017-05-15 Mon 12:23]: Yoni Heisler agrees.

Posted in General | Tagged , | Leave a comment

The Benefits of Reading Code

I’m a big advocate of reading code. A lot of what I know about programming, Unix, and Emacs, I learned from reading code. Chen Bin has a parallel if slightly different take on reading code. He says that mastering Emacs is easy if you read the code. He likes to treat packages as a collection of APIs whose source code he can read and use for his own purposes.

As an example, he considers Samuel Barreto’s excellent post on refactoring with counsel-ag that I wrote about earlier. Chen spent a few minutes looking at how counsel built the wgrep buffer and then leveraged that to do some additional processing before calling wgrep. It’s worth taking a look at what he did. You probably won’t need his code but it perfectly illustrates his point: if you read the Emacs code it’s very easy to extend it to solve your particular problem.

Posted in General | Tagged | Leave a comment

Imenu for Dired

Matus Goljer—Fuco1 of Smartparen fame—blogged a nice bit of Elisp that adds imenu functionality to dired. At first, that doesn’t seem to make sense since an imenu menu would simply have the same information as the dired listing itself. What actually happens is that imenu gives you a list of the subdirectories inserted into the dired listing. You can then jump directly to that subdirectory from imenu

If you think that might be useful, take a look at Fuco1’s post for the details.

Posted in General | Tagged | 1 Comment

A Company-wide Emacs Configuration

Daniel Gopar over at Emacs.el has another of his Emacs chats up. This time he talks to Charles Lowell from Frontside Software. What’s interesting about Frontside is that they have a company-wide, shared Emacs configuration. All the developers use the same configuration, which the company maintains.

My first reaction was one of horror. All developers have preferences—this compiler or that PDF reader—but mostly they’re just that: preferences. If your company doesn’t use your favorite C compiler, you grumble a bit but get on with things. Not so with editors. Every first class developer that I know cares passionately about their editor and wouldn’t dream of using something else. With Emacs, you pretty much build your own editor so you get the same reaction if you have to use a different configuration. Most of us know how painful it can be to use someone else’s Emacs. That’s because their configuration is different from yours. I would, therefore, be very leery of coming into a shop that had a company standard editor.

Still, Lowell makes a reasonable case for their practice and it’s not quite as draconian as I’m making it seem. Nevertheless, having to unlearn my Emacs muscle memory would be extraordinarily painful for me. I’ve seen cogent cases made for insisting on everyone using the same versions of packages and editor—especially in shops doing research and running experiments—but it’s much harder, I think, to make the case for having standardized key sequences. Of course, everyone’s mileage varies and the folks at Frontside seem to like the system so it appears to be working for them.

One interesting aspect of Frontside’s practice is that they package their configuration as an Emacs package. That means that the developers update their configuration the way they would any package and it brings in the changes and updates their other packages automatically. If you’re going to insist on a standard configuration, that’s a very nice way of doing it. It’ quick and easy and no one has an excuse for not staying up to date.

Take a look at the video and see what you think. The running time is 43 minutes, 45 seconds so plan accordingly.

Posted in General | Tagged | 2 Comments

Running Your Life from Your Smart Phone

Back in February, I wrote that more and more functions are being moved into our smart phones. That includes things like ATM cards, credit cards, driver licenses, and even unlocking doors. This is something I welcome—although Noonian Atall pushes back a bit—as a simplification of my life and a reduction in the number of things I have to carry around.

These advances are still nascent here in the U.S. and probably most of the Western world but China has fully embraced the concept. The story of how the Chinese leverage their phones for running their lives is an interesting one. I first learned of this from a Daring Fireball post about problems the iPhone is having in China. You can read Gruber’s post for the details but the TL;DR is that iOS doesn’t have the loyalty in China that it does elsewhere because the Chinese experience in concentrated in a single app: WeChat. WeChat is the portal through which the Chinese access all the services they need in their daily lives. It has, in effect, replaced iOS and Android as the operating system for smart phones, at least from a user perspective.

Gruber quotes Ben Thompson as saying

There is nothing in any other country that is comparable: not LINE, not WhatsApp, not Facebook. All of those are about communication or wasting time: WeChat is that, but it is also for reading news, for hailing taxis, for paying for lunch (try and pay with cash for lunch, and you’ll look like a luddite), for accessing government resources, for business. For all intents and purposes WeChat is your phone, and to a far greater extent in China than anywhere else, your phone is everything.

If you want to know more about WeChat and its influence in China, Connie Chan has a great post about it over at the Andreessen Horowitz blog.

I’m not sure that WeChat is what I want for the future but I do love how the Chinese can handle so many mundane chores with their phones. My guess is that iOS and Android will begin integrating more and more of these functions if only to avoid being made irrelevant. I prefer that solution if for no other reason than the single point of failure—Apple or Google in this case—is large enough that it probably isn’t going away soon. Apple also has the advantage that they aren’t interested in harvesting your information and selling it to advertisers, something I very much care about.

Posted in General | Tagged | Leave a comment

Jumping Directly to Org Headers

Last week I wrote about finding out about counsel-imenu from Arjen Wiersma’s Emacs configuration. Today, I discovered something new about it. Filipe Silva was looking for a way to jump to an Org mode heading using fuzzy completion.

There were a lot of suggestions but the one that jumped out at me was to use counsel-imenu. Naturally, I immediately tried it and it worked just as advertised. In the past I would occasionally use org-goto (bound to Ctrl+c Ctrl+j) but it never seemed to get me where I wanted to go easily, whereas counsel-imenu does exactly what I want.

If you aren’t already using swiper and counsel, I urge you to give them a try. I’ve been using them ever since Mike Zamansky’s video on swiper goaded me into giving them a try and I’ve found that they have given me a significant efficiency bump in searching and navigation. My newfound use for counsel-imenu is just one more example.

Posted in General | Tagged , | 1 Comment

How to Make Swiper Choose the Second or Subsequent Match on a Line

Chanyoung is a Swiper user and asks a question I’ve sometimes wondered about: when using swiper, how do you choose the second or subsequent match on a line? If you follow the above link, you will see that abo-abo himself provides the answer.

What you do is call swiper-avy (bound to Ctrl+) to see tags for every visible match. Then you simply choose the correct tag in the usual Avy way. I’ve known about (and even used) swiper-avy for some time but I always thought of it as a way of choosing the correct line in the minibuffer. That usually brings you to the match you want but not (necessarily) when there is more than one match on the line you want.

It turns out—although I somehow never noticed it—that the visible matches in the searched buffer are also tagged so you can simply choose the tag you want and jump right to the desired match. I know I’ve said it before, but if you aren’t using swiper and counsel you owe it to yourself to give them a try. I’m always learning something new that they can do and they’ve made my navigation a lot more efficient.

Posted in General | Tagged | Leave a comment