An Easy EmacsGolf Challenge

Here's an easy EmacsGolf challenge that came up today. I have an org file in which some of the headings have a check mark (✓) at the beginning of the heading (but after the stars). The file is quite long and I want to count how many check marks there are in the file.

For clarity, the file looks something like this

 * Level 1.1
 ** ✓ Level 2.1
   blah blah blah
 ** Level 2.2
   blah blah blah
 * Level 1.2
 ** Level 2.1
   blah blah blah
 * Level 1.3
 ** ✓ Level 2.1
   blah blah blah
 ** Level 2.2
   blah blah blah
 ** ✓ level 2.3
   blah blah blah
...

Here are the rules:

  1. There are no check marks in the body of the text, only at the beginning of some headers.
  2. You may assume that there's an abbreviation, cb, for ✓.

The challenge is to find the total number of check marks in as few a number of keystrokes as possible.

This entry was posted in General and tagged . Bookmark the permalink.
  • Artur Malabarba

    C-M-%
    cb space return return !
    C-/

    8 keys

  • Xah

    occur cmd. I have a key for it. So 4 keys. Menu key,g, cb,return. (typed on a tablet )

    • now on desktop. a nice one. I use this command a lot, like several times per hour. occur, but i prefer the name list-matching-lines. So, on dvorak keyboard, i have it set to 【menu g】. So, 【menu g cb Enter】 does for me.

      before i started to use a whole set weird keys, i used to have alias lml for it, but later just o. I believe, in plain gnu emacs, simply M-x oc will also catch it.

      for emacs beginners, there's also delete-matching-lines, i often use together.