Torstein Johansen on Dumb-jump

Torstein Johansen has a short video on one of my favorite navigation packages. These days, everyone appears to want Emacs to offer the completion of those LongAndStupidFunction.names beloved by Javanistas and others. You can’t blame them, of course, but that means running LSP or Eglot. Fortunately, the languages I use don’t have sesquipedalian function names or calling sequences so I’ve never bothered setting up LSP or Eglot.

One thing I do like to do, though, is jump from a class or function reference to its definition. The traditional way of doing this is with a TAGS file but means keeping the TAGS file in sync as you make changes. That’s okay for a static project but doesn’t work well when a project is under active development.

My long term solution to this is dumb-jump. I’ve been using it for the last six years and wrote about it here. It really is the sweat spot for me. Johansen’s video discusses dumb-jump and how he uses it. He discusses something I didn’t know about. Apparently there is now an integration with the Xref framework. That’s nice because it gives you a consistent way of dealing with cross reference navigation. I use the older style that defines custom keybindings. Here’s 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))

in case you want finer control but I like the Xref integration that provides the common operations in a consistent way.

Regardless, dumb-jump is a really useful package. Johansen’s video is only 7 minutes long so it’s well worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

Red Meat Friday: What Are They Expecting?

This probably isn’t really a Red Meat Friday item—unless you’re a dentist—but it is, nevertheless, pretty funny and perfectly captures a common but annoying occurrence at the dentist’s office:

Because it’s unlikely to enrage anyone, you can take this as a break from Irreal’s usual fury-inducing Friday post.

Posted in General | Tagged | Leave a comment

A Short Rant on Passwords

It’s been a while since I’ve grumped about the dumb password rules you find on some sites. They have limits on password length, insist on some custom requirement concerning the number of digits, capital letters, and special characters, or, worst of all, they restrict the character sets you can choose from.

Anytime I see “you can use only the special characters…” I know that the site is insecure and probably storing the passwords in plain text, Why else would you care? The sad thing is that this is a solved problem. We KNOW how to hash and salt passwords and there are turnkey solutions in almost every language used to build Web sites that do so with a simple call. There’s no excuse for the moronic homegrown schemes that do nothing but decrease security.

If you want to enrage yourself, take a look at Dumb Password Rules and the list of sites and their rules. Again, there is no excuse for those stupid artificial restrictions. Anytime you see a limit on password length or a limit on the characters you can use, you can be sure the site isn’t doing the right thing. Sites that do these things should be shunned and shamed until they clean up their act.

But, of course, they won’t be. Instead they’ll continue to promulgate non-sensible rules that serve only to make you and their site less secure. And we’ll all suffer.

Posted in General | Tagged | Leave a comment

Dashes

It will not be news to Irreal partisans that we here at Irreal are enamored of em-dashes. Some say that they are seldom used but I love em-dashes and probably tend to overuse them. Back in the dark ages before ubiquitous personal computers there were typewriters and they had only one type of dash: the hyphen. There was a convention of using a double hyphen for an em-dash but most folks who weren’t professional writers or typesetters had never heard the term “em-dash”.

Until I learned TeX, I wasn’t aware that there are, in fact, three types of dashes: hyphen, en-dash, and m-dash. The TL;DR is that you use a hyphen as a break within words at the end of line, or to connect compound words; the en-dash to separate numerical ranges; and em-dash as a clause separator, sort of like a comma.

The rules are, of course, nuanced and the above doesn’t capture them precisely. For those of you who want to better understand which to use and when, Mister Punctual has a post on the use of hyphens, en-dashes, and em-dashes. Now that reasonable typesetting software is available to everyone, it behooves us all to learn the differences between the various dashes and when to use them.

Posted in General | Tagged | Leave a comment

Asimov’s Three Laws and the Future

I just came across this link to a 1965 short BBC interview of Isaac Asimov concerning his famous three laws of robotics. Those laws, as Asimov stipulates, are purposefully ambiguous to that he can use that ambiguity as a vehicle for his many stories that invoke them.

What struck me most about the interview was his discussion of synthetic organic matter and the possibility of robots and human beings growing closer to each other as the robots are built with more synthetic organic matter and humans incorporate more metal and plastic in the form of artificial organs. What impressed me particularly was that his vision contained echos of Bank’s Culture novels. He envisions a time when humans and robots will share a single culture although he does not foresee—or at least doesn’t mention—the extraordinary AI that the Culture’s robots, especially the Minds, are capable of. Of course, this was in 1965 and computers, let alone AI, were much more primitive than they are today.

The video is only 5 minutes, 42 seconds long yet still manages to raise some provocative points. It left me wishing it was longer but it was nonetheless very enjoyable and something I bet almost all Irreal readers will enjoy.

UPDATE [2023-03-15 Wed 13:43]: Azimov → Asimov

Posted in General | Tagged | Leave a comment

Removing Emacs Key Bindings

Once you’ve been sucked into the event horizon of your Emacs configuration, you’re always adding new bindings. Sometimes it’s for a homegrown function, sometimes it’s to configure a new package. If you longer needed one of those bindings, it’s trivial to simply remove it from your init.el or whatever you’re using.

Sometimes, though, some other package steals one of your bindings. You can either change yours or disable theirs. The question is: how do you disable a binding that’s not in your configuration?

Bozhidar Batsov over at EmacsRedux has the answer. It’s pretty simple: you simply set the binding to nil. He gives the example of paredit adding a binding the conflicted with one used by one of the REPL modes but we’ve all experienced the phenomenon. You can remove a binding globally or locally. Batsov also mentions using global-unset-key or local-unset-key to remove a binding.

Thankfully, this is not something the we have to do very often but it’s nice to know how to do it when the need arrives.

Posted in General | Tagged | Leave a comment

Using Org Mode

Aditya Athalye has a long(ish) and interesting post on how he uses org mode for writing and more. Like many of us, Athalye has used a lot of apps for keeping notes and publishing his blog and slides for his talks. He’s settled on Org for the sames reasons that many of us have:

  • It’s plain text so there’s no data lock-in.
  • It’s easily exportable to a variety of formats.
  • It has the ability to embed code with syntax highlighting.
  • It has the ability, through Babel, to execute that code and capture the results.
  • It offers a unified workflow for a variety of tasks.
  • Its Org markdown syntax is being adopted by a variety of (non-Emacs) apps.
  • It’s “local first” meaning that by default your data is held locally.

His post details how he uses Org and some of the Org features that he doesn’t use. He has no interest, for example, in using it for planning, time tracking, calendaring, or as a “second brain”. He’s content to use it for note taking and publishing.

He’s found, as have I, that Org can take over your life in the sense that it replaces most of your other applications. Sure, there’s still Email, RSS, music, and the rest but Org can subsume most of your record keeping requirements.

As I said, the post is a bit long but it’s a good example of one man’s use of Org mode and how it came to dominate part of his digital life.

Posted in General | Tagged , | Leave a comment

Org Pretty Table

Just a quickie today about something you may or may not care about. The reason you may not care about it is that it only affects the display of your local Org buffer—in particular, the display of tables. If you’re like me, you don’t care about that type of stuff; the default Org display is fine. Other folks disagree and they are no more nor no less correct than I, they simply have different opinions and sensibilities. Some people really enjoy having even their intermediate results look as nice as possible.

For those folks, Matus Goljer (Fuco1) has a nice package that overlays the bare-bones default table boundries with their unicode equivalents. My first thought was that the package would be more useful if it exported these changes to HTML, PDF, and the rest but, of course, that’s just silly. The export backends already take care of that so there’s no need for an external package to do it.

The org-pretty-table package simply makes the Org version of your tables look better. If this appeals to you, by all means install it. If it doesn’t, don’t worry about it: your final product will still look good.

Posted in General | Tagged , | Leave a comment

Happy 50th Birthday to Dark Side Of The Moon

Every year on this date, Irreal interrupts its normal programming to celebrate the birthday of Pink Floyd’s iconic Dark Side of the Moon. As I’ve mentioned before, the album is one of the best selling albums of all time. It spent just a couple weeks short of 3 decades on the 200 best selling albums list.

This year is special. It’s the 50th anniversary of the album. My daughter reports that even kids in her middle school class are talking about it. Think about that: kids talking about an album that was probably released before their parents were born.

The Irreal tradition is to feature a video of one of Pink Floyd’s songs to celebrate the event but this year is different. Because it’s the 50th anniversary, the band is holding a competition for the best animation featuring one the songs from Dark Side of the Moon. Here’s Nick Mason, the band’s drummer, explaining the competition:

It’s certainly possible that a few Irreal readers could produce an entry for this contest. I have no idea of what the prizes are but what could be better than having your animation and name linked with the best rock band of all time?

Posted in General | Tagged | Leave a comment

The Programmer Who Broke The Internet

I just came across a story that offers us several lessons. It’s a tale about a programmer who withdrew a trivial function from NPM and subsequently caused several applications to fail. Some of failures were second order effects in that the failing application’s authors had never heard of the function but it was used in functions that they did use directly.

The function itself simply padded a string on the left with spaces to reach a specified a specified string length. As I said, it’s a trivial function (the implementation is only 11 lines) that anyone—even a rank beginner—could write but it was available in some random library so why reinvent the wheel?

All went well until a billion dollar corporation wanted to use the name of one of the programmer’s other packages and asked him change the name of his. When he refused, they threatened legal action and got NPM to side with them and assign the name to the billion dollar corporation. In a fit of—justifiable in Irreal’s opinion—pique, the programmer withdrew all his code from NPM including the aforementioned left padding function. Things went south immediately as several applications started failing to build.

There are a couple of obvious lessons here. First, exhortations to avoid the NIH syndrome notwithstanding, it pays to avoid deep dependencies, especially those you can’t rely on. It’s fine to depend on, say, the C library (or whatever) and other libraries that are part of the programming language environment, but when you start depending on random libraries untethered to the language runtime you’re asking for trouble.

Second, it’s wise to avoid depending on repositories like NPM that may side with big corporations rather than do the right thing. At least according to the story at the link, the programmer was clearly in the right and the corporation had no argument other than muscle in the form of money on their side.

It seems almost paranoid to say you should avoid using NPM packages on the ground that it’s extraordinarily fragile but as this story demonstrates, sometimes a little paranoia is called for. Of course, some packages offer services that are far too complex to be worth implementing on your own but a left padding function is not among them. Neither the primary application developer nor the secondary library developer should be depending on such things.

Afterword

Over at chaitanya.dev there’s a post that gives a few more details about the controversy. He reaches pretty much the same conclusions that I did: beware gratuitous dependencies.

Posted in General | Tagged | Leave a comment