Getting data from Org Mode tables

Org Mode is an amazingly powerful package for Emacs. I’ve been learning a lot about how to use its support for plain-text tables and spreadsheet calculations.

Using table data in Emacs Lisp with the :var argument

For example, I wanted to be able to define my abbreviations in an Org Mode table in my config. I remembered coming across this technique a few weeks ago, but I couldn’t find the webpage with the code. It turned out to be simple to write from scratch. Here’s the plain text I added to my config.

#+NAME: abbrev
| Base  | Expansion                             |
|-------+---------------------------------------|
| bc    | because                               |
| wo    | without                               |
| wi    | with                                  |
| ex    | For example,                          |
| qm    | [email protected]                   |
| qe    | http://sachachua.com/dotemacs         |
| qw    | http://sachachua.com/                 |
| qb    | http://sachachua.com/blog/            |
| qc    | http://sachachua.com/blog/emacs-chat/ |

#+begin_src emacs-lisp :exports code :var data=abbrev
(mapc (lambda (x) (define-global-abbrev (car x) (cadr x))) data)
#+end_src

The :var data=abbrev argument to the Emacs Lisp source block is where all the magic happens. Here, it takes the data from the table named “abbrev” (which I set using #+NAME: before the table) and makes it available to the code. Emacs evaluates that data when the code is tangled (or exported) to my configuration. The code that’s in my Sacha.el looks like this:

(let ((data (quote (("bc" "because")
                    ("wo" "without")
                    ("wi" "with")
                    ("ex" "For example,")
                    ("email" "[email protected]")
                    ("dote" "http://sachachua.com/dotemacs")
                    ("web" "http://sachachua.com/")
                    ("blog" "http://sachachua.com/blog/")
                    ("ec" "http://sachachua.com/blog/emacs-chat/")))))
  (mapc (lambda (x) (define-global-abbrev (car x) (cadr x))) data) )

Looking up data with org-lookup-first, org-lookup-last, and org-lookup-all

You can do more complex things with Org tables, too. Inspired by Eric Boyd’s talk on his Epic Quest of Awesome (which he based on Steve Kamb‘s), I started putting together my own. I made a list of little achievements, guessed at the years, and assigned arbitrary experience points.

The achievements table had rows like this:

Approximate date Category XP Description ID
2014 Life 50 Became a Canadian citizen – link L_CAN
2014 Programming 20 Used NodeJS and AngularJS for a client project – link P_NOD
2014 Programming 5 Pulled information out of Evernote

I wanted to summarize the points by year: points gained, total points, level (according to a lookup table based on D&D experience points), and description. The lookup table was structured like this:

#+TBLNAME: levels
| Total XP | Level | Adjective             |
|----------+-------+-----------------------|
|        0 |     1 | trained-initiate      |
|     1000 |     2 | experienced           |
|     2250 |     3 | savvy                 |
|     3750 |     4 | veteran               |
|     5500 |     5 | unusually experienced |

Now for the summary table. I created rows for different years, and then I used Org Mode to fill in the rest. (Org Mode! Wow.)

| Year | Points gained | Cumulative points | Level | Adjective        |
|------+---------------+-------------------+-------+------------------|
| 1997 |             0 |                 0 |     1 | trained-initiate |
| 1998 |            10 |                10 |     1 | trained-initiate |
| 1999 |            50 |                60 |     1 | trained-initiate |
| 2000 |            50 |               110 |     1 | trained-initiate |
| 2001 |           100 |               210 |     1 | trained-initiate |
| 2002 |            60 |               270 |     1 | trained-initiate |
| 2003 |           245 |               515 |     1 | trained-initiate |
| 2004 |           115 |               630 |     1 | trained-initiate |
| 2005 |           140 |               770 |     1 | trained-initiate |
| 2006 |            60 |               830 |     1 | trained-initiate |
| 2007 |           270 |              1100 |     2 | experienced      |
| 2008 |           290 |              1390 |     2 | experienced      |
| 2009 |           205 |              1595 |     2 | experienced      |
| 2010 |           215 |              1810 |     2 | experienced      |
| 2011 |           115 |              1925 |     2 | experienced      |
| 2012 |           355 |              2280 |     3 | savvy            |
| 2013 |           290 |              2570 |     3 | savvy            |
| 2014 |           350 |              2920 |     3 | savvy            |
| 2015 |            45 |              2965 |     3 | savvy            |
#+TBLFM: $2='(calc-eval (format "vsum(%s)" (vconcat (org-lookup-all $1 '(remote(accomplishments,@2$1..@>$1)) '(remote(accomplishments,@2$3..@>$3))))))::$3=vsum(@2$2..@+0$2)::$4='(org-lookup-last $3 '(remote(levels,@2$1..@>$1)) '(remote(levels,@2$2..@>$2)) '>=);N::$5='(org-lookup-last $3 '(remote(levels,@2$1..@>$1)) '(remote(levels,@2$3..@>$3)) '>=);L

The TBLFM (table formula) line is very long, so let me break it down.

Points gained:

(calc-eval
 (format "vsum(%s)"
         (vconcat
          (org-lookup-all
           $1
           '(remote(accomplishments,@2$1..@>$1))
           '(remote(accomplishments,@2$3..@>$3))))))

This uses org-lookup-all to look up the value of the first column ($1) in the accomplishments table, from the second row to the last row @2..@>, looking in the first column ($1). It returns the values from the third column of the matching rows ($3). This is then passed through calc’s vsum function to calculate the sum.

Cumulative points: vsum(@2$2..@+0$2) is the sum of the second column $2 from the second row @2 to the current row @+0.

Level: This uses org-lookup-last to find the last value where the operator function returns true. In this case, testing the level from column $3 against each of the values in the levels table’s column $1 while the given level is greater than or equal to the value from levels. When it finds the last matching row, it returns the $2 second column from it. ;N means treat everything as a number.

org-lookup-first is like org-lookup-last, but it returns the first matching row.

Adjective: This one works like Level does, but it returns the value from column $3 instead. I found that it converted the return values to 0 if I used ;N, so I used ;L instead.

Passing data to R or other external programs

Of course, you’re not limited to things that Emacs can do. I wanted to summarize the data in graphs, so here’s what I did.

#+RESULTS: category_analysis

#+name: category_analysis
#+begin_src R :var data=accomplishments :exports both :results graphics :file quest_category.png :height 300
library(plyr)
library(ggplot2)
categories <- ddply(data, c("Category"), summarize, Points=sum(XP))
cat_sorted <- transform(categories, Category=reorder(Category, Points))
plot <- ggplot(data = cat_sorted, aes(x = Category, y = Points))
plot <- plot + geom_bar(stat="identity")
plot <- plot + geom_text(aes(label = Points, x = Category, y = Points + 10, hjust=0))
plot <- plot + scale_y_continuous(expand=c(0,70))
plot <- plot + coord_flip()
print(plot)
#+end_src

I like including source code in published pages for fellow geeks, but having the results come first gives people more context for the source block. So I named the source block using the #+name: directive and defined a #+RESULTS: directive before it. The source block used the :var argument to bring the data in from the accomplishments table. With R blocks, the data becomes available as a data frame that you can then do interesting things with. I used the :file argument to save the output to quest_category.png.

Those are a few ways that you can get data out of Org Mode tables and into Emacs Lisp, other Org Mode tables, or external programs. As I learn more about Org Mode, I find myself using it for more of the things that I used to use Microsoft Excel for – tracking, analyzing, and even graphing. I found it a little difficult to piece together what I needed to do from the manuals and examples on the Web, so I hope this explanation will help you (and that it’ll help me when I forget the syntax, as I’m sure I will). If you come up with something really neat that uses Org Mode tables, tell me what you’ve figured out!

Learning to work on my own things

My annual review showed me that despite my resolution to reduce consulting and focus more on my own stuff in 2014, I actually increased the amount of time I spent working on client projects than I did in 2013 (12% vs 9%). Sure, I increased the amount of time I invested in my own productive projects (15% of 2014 compared to 14% in 2013) and the balance is still tilted towards my own projects, but I’d underestimated how much consulting pulls on my brain.

This is the fourth year of my 5-year experiment, and I’m slowly coming to understand the questions I want to ask. In the beginning, I wanted to know:

  • Do I have marketable skills?
  • Can I find clients?
  • Can I build a viable business?
  • Can I get the hang of accounting and paperwork?
  • Can I manage cash flow?
  • Can I work with other people?
  • Can I deal with uncertainty and other aspects of this lifestyle?
  • Can I manage my own time, energy, and opportunity pipeline?

After three years of this experiment, I’m reasonably certain that I can answer all these questions with “Yes.” I’ve reduced the anxiety I used to have around those topics. Now I’m curious about other questions I can explore during the remainder of this experiment (or in a new one).

In particular, this experiment gives me an rare opportunity to explore this question: Can I come up with good ideas and implement them?

I’m fascinated by this question because I can feel the weakening pull of other people’s requests. It’s almost like a space probe approaching escape velocity, and then out to where propulsion meets little resistance and there are many new things to discover.

The most worthwhile thing I’m learning from this experiment, I think, is to sit with myself until the urge to work on other people’s projects passes. Arbitrarily deciding that Tuesdays are no longer consulting days (leaving only Thursdays) seems to work well for me. I find that I can pick things up readily on Thursdays. The rest of the time, I think about my own projects. Mondays and Wednesdays are writing days, Tuesdays are coding days, and Fridays are for administration and wrapping up.

2015-01-05 Developing my imagination and initiative -- index card

Last year, I found it easy and satisfying to work on other people’s requests, and harder to figure out what I wanted to do. It’s like the way it’s easier to take a course than it is to figure things out on your own, but learning on your own helps you figure out things that people can’t teach you.

What’s difficult about figuring out what I want to do and doing it? I think it involves a set of skills I need to develop. As a beginner, I’m not very good, so I feel dissatisfied with my choices and more inclined towards existing projects or requests that appeal to me. This is not bad. It helps me develop other skills, like coding or testing. Choosing existing projects often results in quick rewards instead of an unclear opportunity cost. It’s logical to focus on other people’s work.

One possibility is to build skills on other people’s projects until I run into an idea that refuses to let go of me, which is a practical approach and the story of many people’s businesses. The danger is that I might get too used to working on other people’s projects and never try to come up with something on my own. In the grand scheme of things, this is no big loss for the world (it’ll probably be all the same given a few thousand years), but I’m still curious about the alternatives.

The other approach (which I’m taking with this experiment) is to make myself try things out, learning from the experience and the consequences. If I’m patient with my mediocrity, I might be able to climb up that learning curve. I can figure out how to imagine and make something new – perhaps even something that only I can do, or that might not occur to other people, or that might not have an immediate market. Instead of always following, I might sometimes be an artist or even a leader.

What would the ideal outcome be? I would get to the point where I can confidently combine listening to people and coming up with my own ideas to create things that people want (or maybe didn’t even know they wanted).

How can I tell if I’m succeeding? Well, if people are giving me lots of time and/or money, that’s a great sign. It’s not the only measure. There’s probably something along the lines of self-satisfaction. I might learn something from, say, artists who lived obscure lives. But making stuff that other people find remarkable and useful is probably an indicator that I’m doing all right.

What would getting this wrong be like? Well, it might turn out that the opportunity cost of these experiments is too high. For example, if something happened to W-, our savings are running low, and I haven’t gotten the hang of creating and earning value, then I would probably focus instead on being a really good follower. It’s easy to recognize this situation. I just need to keep an eye on our finances.

It might also turn out that I’m not particularly original, it would take me ages to figure out how to be original in a worthwhile way, and that it would be better for me to focus on contributing to other people’s projects. This is a little harder to distinguish from the situation where I’m still slowly working my way up the learning curve. This reminds me of Seth Godin’s book The Dip, only it’s less about dips and more about plateaus. It also reminds me of Scott H. Young’s post about different kinds of difficulty.

As a counterpoint to the scenario where I find out that I’m not usefully original and that I’m better off mostly working on other people’s things, I hold up:

  • my Emacs geekery, which people appreciate for both its weirdness and their ability to pick out useful ideas from it
  • the occasional mentions in books other people have written, where something I do is used to illustrate an interesting alternative

So I think it is likely that I can come up with good, useful ideas and I can make them happen. Knowing that it’s easy to get dissatisfied with my attempts if I compare them with other things I could be working on, I can simply ignore that discomfort and keep deliberately practising until either I’ve gotten the hang of it or I’ve put in enough effort and must conclude that other things are more worthwhile.

 

If you find yourself considering the same kind of experiment with freedom, deciding between other people’s work and your own projects, here’s what I’m learning:

It’s easy to say yes to other people’s requests, but it might be worthwhile to learn how to come up with your own.

Read business books more effectively through application, visualization, or reviews

This Quora question on “What is the most effective way to read a book and what can one do after reading?” got me thinking about how I read business books and what I do to make the most of them.

2015-01-08 How to use what you read -- index card

2015.01.08 How to use what you read – index card

Application: The best way to get value from a book is to apply it to your life. Reading The Lean Startup is one thing. Using its Build-Measure-Learn loop to run a business experiment is another. Reading Your Money or Your Life is one thing. Calculating your true hourly wage and using that to evaluate your expenses is another. Do the work.

As you apply an idea, you’ll probably want to refer back to the details in the book, so it’s good to keep the book itself handy. Write notes about your questions, ideas, TODOs, experiences, and follow-up questions.

Visualization: Not ready to do the work yet? Slow down and think about it. Imagine the specific situations where you would be able to apply the ideas from the book, and how you would do so. What do you need to learn or do in order to get there? See if you can get closer to being able to act on what you’ve learned.

Spend some time thinking about how the ideas in the book connect to other books you’ve read or ideas you’ve explored. What do they agree with or disagree with? Where do they go into more detail, and where do they summarize? What new areas do they open up?

Think about specific people who might be able to use the ideas in the book. Get in touch with them and recommend the book, explaining why they might find it useful. Imagine what kind of conversation the book might be relevant to so that you’ll find it easier to recognize the situation when it arises. (This is a tip I picked up from Tim Sanders’ Love is the Killer App, which I often recommend when people want to know more about how reading helps with networking.)

Review: Can’t act on the book yet, and can’t think of specific people or ideas to relate it to? Take notes so that you can review them later, and maybe you’ll be able to think of connections then.

I don’t like writing in books. Here’s why:

  • Most of my books come from the library, and I’d never write in those. This lets me get through lots of books without the friction of committing money and space to them.
  • Highlighting is an easy way to make yourself think that you’re going to remember something. Also, it’s hard to decide what’s important the first time through, so you might end up highlighting too much. When everything’s important, nothing is.
  • There’s rarely enough room in the margins for notes, and you can’t review those notes quickly.

2015-01-09 Take notes while you read books -- index card

2015.01.09 Take notes while you read books – index card

I prefer to write my notes on an index card or a piece of paper. If I’m near my computer, I might draw my notes on a tablet or type quotes into a text file. Keeping my notes separate from the book lets me review my notes quickly without thumbing through the book. I want to be able to refer to my notes while reading other books or while writing my reflections. Index cards, pages, and print-outs are easy to physically rearrange, and text files can be searched. Even if I read an e-book, I take my own notes and I copy highlights into my text files.

The best way to remember to review a book is to schedule an action to apply an idea from it. The second-best way is to connect it to other ideas or other people. If you don’t have either of those hooks, you can review on a regular basis – say, after a month, six months, and a year, or by using a spaced repetition system. You might even pull a book out at random and review your notes for inspiration. When you do, see if you can think of new actions or connections, and you’ll get even more out of it. Good luck, and happy reading!

Emacs microhabit: Switching windows with windmove, ace-window, and ace-jump

When I work with a large monitor, I often divide my Emacs frame (what most people call a window) into two or more windows (divisions within a frame). I like this more than dealing with multiple Emacs frames, even if I could spread those frames across multiple monitors. I find it easier to manage the windows using keyboard shortcuts than to manage the tiling and display of frames.

One of the Emacs micro-habits I’m working on is getting better at switching between windows. When there are only two windows, C-x o (other-window) works just fine. However, when there are three or more, it can take a few repetitions of C-x o to get to where I want. I could get around that by binding other-window to M-o instead, replacing the default keymap for that. Or I could try to get the hang of other ways to move around.

Here’s an 8-minute video showing windmove, ace-window, and ace-jump:

https://www.youtube.com/watch?v=nKCKuRuvAOw&list=UUlT2UAbC6j7TqOWurVhkuHQ

Windmove lets you move around with cursor keys, if you set up the appropriate keyboard shortcuts. Ace-window works like ace-jump. In addition, you can use C-u to swap windows and C-u C-u to delete windows. Ace-jump works across windows, so that’s handy too.

Here’s my relevant code snippet for Windmove. I changed this to use define-key instead of bind-key.

(defvar sacha/windmove-map (make-sparse-keymap))
(define-key sacha/windmove-map "h" 'windmove-left)
(define-key sacha/windmove-map "t" 'windmove-up)
(define-key sacha/windmove-map "n" 'windmove-down)
(define-key sacha/windmove-map "s" 'windmove-right)
(define-key sacha/windmove-map "[left]" 'windmove-left)
(define-key sacha/windmove-map "[up]" 'windmove-up)
(define-key sacha/windmove-map "[down]" 'windmove-down)
(define-key sacha/windmove-map "[right]" 'windmove-right)
(key-chord-define-global "yy"     sacha/windmove-map)

Here’s the cheat sheet I made for myself:

2015-01-12 Emacs microhabit - window management -- index card #emacs

2015-01-12 Emacs microhabit – window management – index card #emacs

And here’s a simpler reference that you can personalize with your own shortcuts:

2015-01-18 Emacs microhabit - Switching windows -- index card #emacs #microhabit

2015-01-18 Emacs microhabit – Switching windows – index card #emacs #microhabit

Naturally, after recording the video, I thought of a better way to manage my windows. I took advantage of the def-repeat-command that abo-abo posted on (or emacs so that I could repeat keybindings easily. I modified the function to accept nil as the first value if you don’t want the keymap to run a command by default, and to use kbd for the keybinding definitions.

  (defun sacha/def-rep-command (alist)
    "Return a lambda that calls the first function of ALIST.
It sets the transient map to all functions of ALIST,
allowing you to repeat those functions as needed."
    (lexical-let ((keymap (make-sparse-keymap))
                  (func (cdar alist)))
      (mapc (lambda (x)
              (when x
                (define-key keymap (kbd (car x)) (cdr x))))
            alist)
      (lambda (arg)
        (interactive "p")
        (when func
          (funcall func arg))
        (set-transient-map keymap t))))

Here’s my new binding for yy. It lets me bounce on y to use other-window as normal, use the arrow keys to move between windows thanks to windmove, and use ace-window as well: h is the regular ace-window, s swaps, and d deletes.

(key-chord-define-global "yy"   
      (sacha/def-rep-command
       '(nil
         ("<left>" . windmove-left)
         ("<right>" . windmove-right)
         ("<down>" . windmove-down)
         ("<up>" . windmove-up)
         ("y" . other-window)
         ("h" . ace-window)
         ("s" . (lambda () (interactive) (ace-window 4)))
         ("d" . (lambda () (interactive) (ace-window 16)))
         )))

Neat, eh?

Writing: Open loops, closed loops, and working with forgetfulness

I think I’ve written about something before, but I can’t find it. I have thirteen tabs open with Google search results from my blog. I’ve tried countless keywords and synonyms. I’ve skimmed through posts I only half-remember writing. (Was that blog post really that short? I thought I wrote more details.) I still haven’t found the post I want.

I wonder: Did I really publish it? Or did I just outline or sketch it? Am I confusing it with something similar that I wrote, or someone else’s post that I admired?

Ah, well, time to write it from scratch. It’s a little like writing code. Sometimes it would take so long to find an appropriate open source module that you’re better off just writing the code yourself. Sometimes it would take so long to find an existing post that it’s better to just write it from scratch.

I was looking for that particular post because of a conversation with Flavian de Lima where I mentioned the benefits of blogging while you’re learning something. He resonated with the idea of sharing your notes along the way so that other people can learn from them, even if you’ve moved on to different topics.

Despite having a clear memory of writing about this topic, when I went to the post that I thought was related to it (spiral learning), it didn’t mention blogging at all. “Share while you learn” didn’t quite address it, either. After trying lots of searches, I gave up and started writing a new post. After all, memories are fallible; you could have full confidence in an imagined event.

The reason this came up was because Flavian described how he often took advantage of open loops when working on writing. He would stop with an incomplete thought, put the draft away, and let his subconscious continue working on it. Sometimes it would be days or weeks before he got back to working on the article. He mentioned how other authors might take years to work on novels, dusting off their manuscripts and revising scenes here and there.

Keeping loops open by stopping mid-sentence or mid-task is a useful technique often recommended for writing or programming. Research describes this as the Zeigarnik effect: an interrupted task stays in your memory and motivates you to complete it.

But after reading David Allen’s Getting Things Done, I had become a convert of closed loops: getting tasks, ideas, notes out of your head and into a trusted system so that you don’t have to waste energy trying to remember them. I noticed that if I kept too many loops open, my mind felt buzzy and distracted. To work around this, I got very good at writing things down.

In fact, I took closing loops one step further. Publishing my notes on my blog helped me get rid of the guilt and frustration I used to feel whenever I found myself wanting to move on to a different project. Because my notes were freely available for anyone who was trying to figure out the same thing, I could go ahead and follow the butterflies of my interest to a different topic. My notes could also help me pick things up again if I wanted to.

I didn’t stop mid-sentence or mid-thought, but I published in the middle of learning instead of waiting until I finished. Even my review posts often included next steps and open questions. So I got a little satisfaction from posting each small chunk, but I still left dangling threads for me to follow up on. I closed the loops enough so that the topics didn’t demand my attention.

Writing helped me clear my mind of strong open loops–but it worked a little too well. I tried to close things off quickly, so that I could revisit them when I wanted to. The trick was remembering that they were there. Sometimes I forgot the dangling threads for a year or more. I never followed up on others. Even with my regular review processes, I often forgot what I had written, as in the search that prompted this post.

Writing and memory have an ancient trade-off. Even Socrates had something to say about it, quoting an ancient Egyptian king in Plato’s The Phaedrus:

“…for this discovery of yours will create forgetfulness in the learners’ souls, because they will not use their memories; they will trust to the external written characters and not remember of themselves.”

as quoted in On writing, memory, and forgetting: Socrates and Hemingway take on Zeigarnik

In 2011, Sparrow, Liu, and Wegner showed that people remember less if they think a computer will keep their notes for them, and they tend to remember how to get to the information rather than the information itself. Having written the words, published the posts, and indexed the titles, I’ve forgotten the words; and now I can’t find my way back.

Hence my immediate challenge: sometimes I forget how to get to the information I’ve stored, like a squirrel stashing nuts. (More research: tree squirrels can’t find 74% of the nuts they bury. So I’m doing slightly better than a squirrel, I think.)

Google helps if I can remember a few words from the post, but since it tends to search for exact words, I have to get those words right. Hah, maybe I need to use search engine optimization (SEO) techniques like writing with different keywords – not for marketing, but for my own memory. It reminds me of this SEO joke:

How many SEO copywriters does it take to change a lightbulb, light bulb, light, bulb, lamp, bulbs, flowers, flour…?

My blog index is helpful, but it isn’t enough. I need to write more descriptive titles. Perhaps I should summarize the key point as well. Maps can help, as can other deliberate ways of connecting ideas.

Let me take a step back and look at my goals here. Linking to posts helps me save time explaining ideas, build on previous understanding, and make it easy for people to dig into more detail if they want. But I can also accomplish these goals by linking to other people’s explanations. With so many people writing on the Web, chances are that I’ll find someone who has written about the topic using the words I’m looking for. I can also write a new post from scratch, which has the advantages of being tailored to a specific question and which possibly integrates the forgotten thoughts even without explicit links.

It’s an acceptable trade-off, I think. I’ll continue writing, even with the increased risk of forgetting. If I have to write from scratch even when I think I’ve probably written about the same topic before, I can accept that as practice in writing and thinking.

Other writers have better memories. Flavian told me how he can remember articles he wrote in the 1990s, and I’ve heard similar accounts from others. Me, I’ve been re-reading this year’s blog posts in preparation for my annual review, and I’ve come across ones that pleasantly surprised me. Posts two or three years back are even fuzzier in my memory. I can try to strengthen my memory through exercises and processes. The rest of the time, I can work with the brain that I have. In fact, I’m inclined to build more memory scaffolds around myself, moving more of my memory outside my mind.

[I do not] carry such information in my mind since it is readily available in books. …The value of a college education is not the learning of many facts but the training of the mind to think.

  • Albert Einstein, as Wikiquotes cites from Einstein: His Life and Universe (2007)

And really, how much difference would perfect memory make? I might add more links, include more citations, cover more new ground. I can still learn and share without it.

Forgetful squirrels have their uses. Forgotten acorns grow into oaks for others to enjoy. From time to time, I hear from people who’ve come across old posts through search engines, or I come across old posts in a review. Loops re-open, dangling threads are taken up again, and we continue.

Emacs kaizen: helm-swoop and editing

Continuing on this quest to focus on one tiny little workflow change at a time, so that I can get even better at using Emacs…

One of those packages I installed but never got around to trying out was all, which lets you interactively edit all lines matching a given regular expression. It’s like an editable occur, sorta.

It turns out that helm-swoop lets you use C-c C-e to edit matching lines interactively (so you can use keyboard macros or replace-regexp or whatever). You can type C-x C-s to save it back to the buffer.

On a related note, I’m still tickled pink every time I use dired-toggle-read-only (C-x C-q) to make a Dired buffer editable so that I can batch-rename filenames.