An Oldie but Goodie

I was looking at some old Irreal posts and stumbled across this post. It’s something that I’d completely forgotten about so I thought it would be worthwhile pointing to it again.

The TL;DR is that when using Magnar Sveen’s excellent Multiple Cursors you can narrow to the matched lines (and a little context) by calling mc-hide-unmatched-lines-mode. It’s really handy when the targets are spread out in a larger buffer because you can see all (or at least more) of the targets on the screen. Take a look at the original post for the details.

Posted in General | Tagged | Leave a comment

Linux Journal on Scimax

Over at the Linux Journal, Joey Bernard has a nice article on John Kitchin’s scimax. I’ve written about scimax before but for those who came in late, it’s a collection of Emacs and Org mode tools to make using reproducible research methods for performing and writing about research easier.

If you’re doing research and especially if you’re publishing your results you really should check out scimax. A good way to see what it can do for you is to take a look at its manual or by watching Kitchin’s video

Posted in General | Tagged , | Leave a comment

The Em-Dash

Those of you who have been around for a while and who pay attention to such things have probably noticed that I’m partial to—probably overly partial to1—the use of em-dashes. I no longer remember for sure how it started but it’s probably something I learned Rich Stevens who had a large influence on my early writing.

I used them in this blog even when—for reasons I still don’t understand—they didn’t render correctly in the RSS feed (despite being fine in the post itself). They’ve always seemed to me to be the perfect way of setting off those interstitial remarks that amplify but aren’t really part of the main flow of my thoughts.

Considering all this, I was delighted to see that Adam O’Fallon Price has posted a lovely paean to the em-dash. Price says that the em-dash is rarely used. That’s news to me, probably because I see so many of them in my own writing. Nevertheless, he says, it’s a beautiful and useful punctuation mark that conveys subtle distinctions in meaning from the comma, colons, and parentheses that it often replaces. He goes on to give several examples of their use and the added precision they bring to the writings of such people as Vladimir Nabokov, Donald Antrim, and Emily Dickinson.

All of this is outside of the usual Irreal purview, of course, but it seemed like a pleasant Sunday interlude, nicely set off by metaphorical em-dashes from our more routine subject matter.

Footnotes:

1

See what I did there?

Posted in General | Tagged | 3 Comments

A Handy Calc Tip

As I wrote three weeks ago in these two posts, I’ve renewed my efforts to become semi-proficient with Calc. On the one hand, it’s not that hard. By default, it’s simply a stack based RPN calculator of the sort that I’m very familiar with from my HP calculator days. Some of the symbolic mathematics parts are a bit trickier but not very much so.

What really makes Calc hard is the huge number of commands it implements and the assignment, seemingly higgledy-piggledy, of those commands to one or two letter shortcuts. Unlike a calculator, there’s no convenient SQRT button to press: you’ve got to remember its shortcut, Q, instead. Suppose, for example, I want to factor the integer 3469394 into its prime factors 2, 17, 67, 1523. I know there’s a command to do that but I don’t use it enough to remember the shortcut—it’s k f but I only know that because I’m peeking at the cheat sheet.

Of course, all those shortcuts are bound to Elisp functions in exactly the same way that Ctrl+x Ctrl+f is bound to find-file so you can call them directly with Meta+x in the usual way. Now all you have to remember is that the command involves “prime factors” and Avy, Ido, or whatever you use will help you find calc-prime-factors. But it gets even better. The shortcut x will start the process for you by calling Meta+x and filling in the calc- part that starts every Calc command. Now to factor 3469394, you simply push it onto the stack, type x and enough of prime factors for command completion to do its thing.

The power in this is not that it saves some keystrokes but that you can easily find a function whose obscure shortcut you don’t remember. Theoretically, which-key or something similar will do this too but then you have to remember that the factoring command starts with a k. That’s precisely the hard part; I can probably remember the f on my own.

If you’re always factoring numbers (or whatever) you’ll learn the shortcut of course but what about the Bessel \(J_{\nu}\) function? Since I learned and internalized the x shortcut, I’m finding it much easier to get a grip on Calc.

Update [2018-01-06 Sat 17:53]: I → you (a couple of times)

Posted in General | Tagged , | 6 Comments

Frame Peek

As part of his Emacs mini manual series, tuhdo introduces an interesting idea for quickly looking at, say, a function definition. There are lots of ways of doing that, of course, and tuhdo isn’t advocating any particular one or eve a new one. Rather, you can think of his suggestion as providing a framework for quick-look systems.

To understand what that means, you first have to understand what tuhdo sees as the problem with the way current systems work. Some of them pop up a little subwindow with the required definition but the space is delimited and there’s probably no font locking or other amenities that we’re used to having with buffers. Others open a new buffer either in the same or another window. That can also be annoying even if it opens the new buffer in a different window because that window may also hold useful information that you want to see. Finally, a long string of nested such lookups can mean that you lose your place and have to search for your original buffer.

Tuhdo’s idea is to pop up a new frame positioned right under the symbol at point, use whatever quick-look mechanism you prefer—his demo uses the rtags-find-symbol-at-point function—and display that definition in a buffer in the new frame. That means the “popup” has all the capabilities of a normal buffer and it’s easy to nest calls without losing your way. You merely delete the frames to unwind the calls in a natural way.

Take a look his demo at the link. It makes all this clear and shows how natural and easy it is to use. It doesn’t take much code to do this. Tuhdo shows the code for using rtags, which you can just cut and paste into your init.el. If you use some other system, it should be easy to adapt.

Posted in General | Tagged | 2 Comments

Imenu

Here’s a useful reminder from Wilfred Hughes:

I say “useful reminder” because—at least for me—it’s easy to forget about it. That’s true even though I have it bound to an easy keystroke, Ctrl+..

I originally set it up to make package configurations in my init.el easy to find but it’s actually handy for navigating in most languages. It gives you a list of functions and top level variables and, if you do such things, classes. When combined with counsel-imenu you get a nice Ivy-like list of candidates that you can successfully refine to narrow in on exactly what you’re looking for.

The reason that I often forget to use it is that swiper is so powerful that it’s my automatic go-to-tool when I’m looking for something in a file. That’s true even if I just want to glance at it and not necessarily move to it. Still, imenu is useful and gives a nice overview of what’s going on in a source file. It’s worth trying to remember to use it.

Posted in General | Tagged | 1 Comment

Lava Lamps

If you’re a geek with an interest in cryptography, you know that one of the hardest problems in practical cryptography is random number generation. A weak PRG (pseudorandom number generator) is one of the surest ways to get a cryptographic protocol compromised. Most PRGs depend on random events such as mouse activity, disk latency, and other such non-deterministic events to seed the PRG with the required randomness.

You may also know that lava lamps, that refuge from the 1960s, can also produce random numbers1 but if you’re like me, you’ve probably always considered that a (geek) cocktail party factoid of no particular use. It turns out I couldn’t have been more wrong. Cloudflare, which handles about 10% of international Internet Web traffic, uses lava lamps to generate their random numbers. They have a wall with over 100 lava lamps that are busily bubbling away. A video camera captures the action and sends it to a computer for conversion into random numbers. This is an elegant and relatively low cost way of producing the large amount of random numbers that an operation like Cloudflare requires.

Oddly, the 53 year old fad remains strong to this day and you can still get a lava lamp. It makes me wonder what the Hippies would have thought of their beloved lava lamps being used as an integral part of computer communications.

Footnotes:

1

If you’re interested in the details, here’s a nice explanation. It’s a lot simpler than you might think.

Posted in General | Tagged | Leave a comment

Typesetting the TeX and LaTeX Symbols with Org Mode

After writing yesterday’s post, I poked around a bit on Higham’s site looking at some of his recent posts. I’m glad I did because I discovered that something I’ve wanted to do is possible. Occasionally I want to typeset the TeX or LaTeX symbol in a blog post. After a bunch of experimentation I discovered that $\LaTeX$ does typeset the symbol as \(\LaTeX\) but it typesets it in Math mode, which gives it an Italic look. I experimented some more but couldn’t get it to set the symbol in Text mode. I concluded that that was just the way it was. (Yes, I know, it’s Emacs; of course it’s possible.)

But looking at this post of Higham’s, I noticed that he was getting it typeset properly as \(\mathrm{\LaTeX}\) and his blogging workflow is very much like mine. One of the things I learned from my Mathematics training is that it’s often true that knowing a problem has a solution makes it easier to find that solution. That’s exactly what happened here: the first thing I tried worked.

So here’s the solution:

  • $\mathrm{\TeX}$ → \(\mathrm{\TeX}\)
  • $\mathrm{\LaTeX}$ → \(\mathrm{\LaTeX}\)

Oddly, I tried a solution like that before but apparently didn’t get the incantation exactly right.

I’ll probably complete the solution by adding a couple of snippets (or maybe an autocompletion) to make it easier to add the markup to my Org files.

Posted in General | Tagged , | 5 Comments

Tweets on Emacs and Org Mode

Nick Higham, whom I’ve mentioned before (1, 2), is a Mathematician and Emacs user. He also, apparently, is like me in that he likes collecting odd bits of information and data. One bit of data that he likes to collect are tweets about Emacs and Org mode.

For those of you who also enjoy such things, Higham has a blog post that displays his collection. You’ll probably recognize some of them as they went viral or at least as viral as a tweet about Emacs and Org mode can be said to be. In any event, I enjoyed browsing through his collection. Perhaps you will too.

Posted in General | Tagged , | Leave a comment

König 36: A Third Way of Setting and Tracking Goals

Rainer König is back with a followup to his previous video on setting and tracking goals that I wrote about a week ago. This time he approaches the task using hierarchial tags. With hierarchial tags, you give a set of related tags a group name and can then search or filter the tags by the group name. You can even describe the members of a group with a regular expression so you don’t need to know what they are in advance.

That works out perfectly for König’s purpose because he can tag each individual goal with a unique tag that ties together all the tasks related to that goal and can also refer to all goals by using the group name. See the video for the details on how he used it for tracking goals.

I didn’t know about hierarchial tags before but it’s easy to imagine lots of use cases for them. The Org Mode manual page for them is here. If you like using tags to tie things together, you should definitely take a look at hierarchial tags. You can even have sub-groups (and sub- sub-groups, etc.) so the device is very flexible.

The video is just short of 8 minutes so it should be easy to work it in. If you have time, you might also want to rewatch his previous video to refresh the context.

Posted in General | Tagged , | Leave a comment