Org-mode Gems

Every Org-mode user is aware that Org is a huge package stuffed with all sorts of useful functionality. For most of us, a lot of that functionality remains unknown and hidden. Most often the only way to find out about it is to read the Org-mode manual but that can be an undertaking.

Luckily, Cheong Yiufung has done the reading for us and made a very nice post that reveals some of the gems he found. The post mentions six pieces of functionality and illustrates them with animated GIFS. The six items are:

  1. Avoid inadvertently editing in a folded area.
  2. Show headings only.
  3. Clone trees with a time shift.
  4. Hide empty lines between headings in collapsed view.
  5. Turn lists into subtrees.
  6. Demote sequence for list bullets.

He also mentions a couple of miscellaneous items.

I’ve been a heavy Org user for many years but all six of those items were new to me. With Org, as with Emacs, there’s always something else to learn. Perhaps I should just RTFM from cover-to-cover but I’ve never had much luck in reading whole manuals. Fortunately in this case, Yiufung has done that for me. If you’re an Org user, you really should spend a few minutes reading Yiufung’s post. It’s a great post and definitely worth your time.

Posted in General | Tagged , | Leave a comment

Another Org-mode with Spacemacs Tutorial

Nathan Lovato has a tutorial on using Org-mode with Spacemacs. It’s longer and more comprehensive than Jack of Some’s introductory video on Org with Spacemacs, but as with that video, Lovato’s looks at Org from the Spacemacs user’s point of view. If you’re not a Spacemacs user, you probably won’t find the tutorial too helpful. If you are a Spacemacs user or are thinking of becoming one you might find it useful.

After a short introduction, he covers creating and manipulating nodes, widening/narrowing, lists, and checkmarks. Then he moves on to using Org for task management, including TODO keywords and time tracking.

Next, he takes up using sparse trees, column view, tags, and sorting. He approaches these from the point of view of searching and organizing your data. I, at least, usually forget about sparse trees and column view but that’s a mistake because they can be very useful for accessing your data. Lately, I’ve been making a point of using it just to burn it into my muscle memory.

Finally, he shows how he exports his Org data to his (Android) smart phone using Orgzly. Of course, if you’re living on the Apple plantation, Orgzly won’t work for you but there are other options such as beorg.

The best way to think of this tutorial is not as a how-to but as a demonstration of some of the things Org can do. The video moves quickly but Lovato provides a list of topics and their timestamp so you can easily revisit any topic you want to see again.

Posted in General | Tagged , | Leave a comment

Alzheimer’s and Gaming

Years (and years) ago, the usual crazies were running around making dire predictions about Rock and Roll and how it was going to destroy young people. It seems pretty ludicrous now but these people were serious and generally made pests (and fools) of themselves for many years.

Fast forward half a lifetime and another bunch of crazies were (or, perhaps, are) running around screaming that video games are going to be the death of our youth. Perfectly useless wastes of time. Maybe they should be outlawed. And, well, you know…

Now in an especially delicious piece of irony, CNN is reporting that researchers have been using a video game to diagnose early stage Alzheimer’s disease. The diagnoses, it turns out, are more accurate than the standard medical tests. You can follow the link for the details but the TL;DR is that an early sign of Alzheimer’s is a subtle deficiency in spatial awareness and navigation skills. The game, which involves navigating through a maze, can detect these deficits years before the memory problems that we associate with Alzheimer’s appear.

The CNN article has a link to a paper describing the research where you can read the abstract. Sadly, the paper itself is behind a paywall. This is a fine opportunity for a rant about Open Science—especially science that we’ve already paid for—but I’ll forbear.

Posted in General | Tagged , | Leave a comment

Tabs and Indentation in Emacs

To my mind, one of the most confusing and arcane “everyday things” in Emacs is the subject of tabs, the Tab key, and indentation. I’ve been using Emacs for over a decade but I still remember how hard it was for me to get Emacs configured to do what I wanted. Back in those days, I was still doing a lot of C coding and the default behavior of C indentation was so odd and off-putting that I almost gave up on Emacs and went back to Vim. Being a n00b, I had no idea how to fix things so I asked Google and found some configuration items to put in my init.el that made things work correctly.

When I was researching this post, I searched my init.el for “indent” and found that I still wasn’t clear on what some of those configuration items were doing. These days, of course, I know how to look them up but you’d think after all this time I’d understand these things a little better.

Doug Beney to the rescue. Over at dougie.io he has a very useful post that discusses how to get tabs and spaces to work as you’d like them to. It’s definitely worth reading to get a handle on how to get indentation and the Tab key working in a sane manner.

Beney likes using tabs instead of spaces and his default configuration reflects that. I’ve never cared much about that controversy but I’ve come to believe that spaces are the better answer (this despite my using tabs in my Vim days). Beney is careful to show how to configure things to use spaces and even provides a couple of functions to enable one or the other so if you’re in the spaces camp, the post is still useful.

Posted in General | Tagged | Leave a comment

Brian Kernighan & Ken Thompson Chat

Last Saturday at the Vintage Computer Festival East, Brian Kernighan and Ken Thompson sat down and chatted about some Unix history and other interesting events in Thompson’s life. The chat was billed as “Kernighan interviewing Thompson” but it was really more like two old friends sitting down and reminiscing. Happily, there’s a video of the chat.

You don’t often see Thompson in public and I can’t recall ever hearing him say more than a few words so the video is a real treat. He turns out to be an engaging and amusing speaker and, of course, there is no one more qualified to talk about the early days of Unix than he.

He tells the story of how after AT&T withdrew from the Multics project and declared that Bell Labs “would no longer do operating systems” the small group (about 4) of users of the nascent Unix system wanted to move it off the PDP-7 to a larger machine. The request for a new machine was denied because “we don’t do operating systems” so Joe Ossana came up with a fib about them building a word processing system for the Patent Department. That proposal was accepted and Unix was officially under way.

Thompson tells a bunch of other stories, including how he came to work at Bell Labs and a slightly different version of the genesis of grep. The whole thing is an hour and 4 minutes so you’ll definitely need to schedule some time but it’s a great video and you really should watch it. It may be your last chance to hear about early Unix from the people who built it.

Posted in General | Tagged , | Leave a comment

A Practical Guide to Sed

Yesterday, I wrote about Liran B. H’s Practical AWK Guide. He has a similar guide for sed called Understanding sed – Practical Guide. Like the Practical AWK post, it illustrates some of sed’s power by showing a few sed one-liners.

Sed is, in principle, pretty simple—especially if you’re familiar with Vi/Vim colon commands—but in practice it can be tricky to get its use exactly right. That’s the real value, I think, of guides like this: it serves to remind us of the basic form of the commands and some of the common tasks it’s used to perform.

If you like the command and want more, the best “quick” guide that I know of is this one. Sadly, tools like sed (and even awk) aren’t used as much these days. It’s sad because they’re powerful tools that often provide a much faster and easier way to accomplish certain tasks than the tools that have replaced them.

Posted in General | Tagged | Leave a comment

A Practical Guide to Understanding AWK

Over at the Developers Area, Liran B.H has a nice practical guide to understanding AWK. There’s a whole book dedicated to AWK so obviously a single blog post isn’t going to cover everything but it does speak to one of AWK’s most powerful features: the one-liner. Brian Kernighan—the ‘K’ in AWK—has said that AWK excells in 1, 2, or 3 line programs and is hard to beat in that domain.

Liran B.H’s guide focuses on short programs for manipulating text data and shows a small amount of the power that AWK has. Two of my favorite features of AWK are the implicit main loop that reads each line of the text and operates on it usually as the result of matching some regex. The other part I like is that all arrays are associative arrays and you don’t have to worry about what form an array index takes or even keep their type consistent. You use whatever’s handiest and it just works. These days, of course, most “modern” languages have associative arrays built in (although maybe not by that name) but when AWK was first implemented, that was much less true.

The post doesn’t cover arrays but does a good job on the implicit main loop and using regexes to trigger actions. AWK is a nice language for certain types of problems and well worth knowing. Take a look at the post and if you want more, find a copy of the AWK book or check out more comprehensive guides such as this one over at Grymoire.com.

Posted in General | Tagged | Leave a comment

Two Nice Org-mode Tutorials

Today I came across two Org-mode tutorials: one a blast from the past, the other new. If you enjoyed yesterday’s post on Jack of Some’s introductory Spacemacs video, you may also like his new video on the absolute minimum you need to know about Spacemacs and Org-mode. As the link tag suggests, it’s an introductory tutorial on using Org-mode with Spacemacs. Org-mode is Org-mode, of course, but Spacemacs has its own shortcuts that won’t be familiar if you’re used to vanilla Emacs.

The value of this tutorial is that it shows how to do elementary Org-mode things in Spacemacs. You won’t learn a whole lot about Org-mode itself as Jack purposely avoids the more advanced topics. My only complaint is his method of adding a header line to a table. Org has shortcuts for this—which probably work with Spacemacs—and no doubt Spacemacs has a custom binding for it. In any event, you can always call org-table-insert-hline directly.

I’ve written about the second video before. It’s Niklas Carlsson’s Literate Programming in Emacs Org-mode. Someone tweeted a link to it and I watched almost the whole thing before I realized that I’d seen it before. It’s a long video and the information content is very dense but it’s one of the best Org-mode videos I know of. As I say, I got so interested in what he was doing that I forgot I’d already seen it. If you haven’t already watched it, you definitely should. I learned a lot from it both times I did.

Posted in General | Tagged , | Leave a comment

Introduction to Spacemacs

Many Irreal readers are fans of Spacemacs. The Spacemacs motto is “The best editor is neither Emacs nor Vim, it’s Emacs and Vim!” That’s a good summary of what it’s all about. If you’ve wondered about Spacemacs or are thinking about trying it out, Jack of Some has a nice video introduction to it on YouTube.

The video begins by covering installation and configuration. I’m not a Spacemacs user so I can’t say for sure but it seems as if the configuration is easier than with vanilla Emacs. Regardless, it’s pretty easy to get things set up.

Most of the video discusses navigation. If you’re used to vanilla Emacs, it will seem foreign. You have the normal Vim keybindings, of course, but there are also special Spacemacs shortcuts that start with what they call the “leader key” (defaulted to Space) followed by 1 or more command keys. The command keys are meant to be mnemonic and as Jack says, you can often guess what the shortcut for a command is even if you aren’t familiar with it. As with Vim, these shortcuts are short and fast to type. You also get a which-key-like help screen if you pause while typing. You can, of course, also use the familiar Emacs shortcuts.

Jack is planning further videos on Spacemacs so you can subscribe to his channel if you’re interested in pursuing the Spacemacs way. Even if you aren’t, the video is worth watching so you can read discussions of Spacemacs intelligently.

Posted in General | Tagged | Leave a comment

Logging Money with Org-mode

Ilker Mutlu tweeted a pointer to an old post by Brian Wisti on how he uses Org-mode to log money. His technique uses only elementary features of Org-mode so, in a sense, it’s not worth recapitulating the post but if, like Mutlu, you’re looking for a light-weight method of tracking income and expenses, you may find the Wisti’s solution useful.

If you’re looking for a full-fledged personal bookkeeping solution, this isn’t it; you should take a look at John Wiegley’s ledger program and the associated ledger-mode for Emacs. If you’re not ready for a double-entry accounting system and its complexities, Wisti’s solution may be just what you’re looking for. Wisti effortlessly integrated his technique into his existing journal but his method works whether or not you are already logging things.

I display my journal entry headers in my agenda so that it can serve as a précis of my day. I would, therefore, prefer an active timestamp rather than the inactive one that Wisti uses. That’s just a matter of changing the %U to %T (or perhaps %t if you don’t care about the time) in his capture template.

Even if you’re not in the market for a way of logging money transactions, it’s worth taking a look Wisti’s post as a nice example of an application of Org-mode.

Posted in General | Tagged , | Leave a comment