Command-Frequency-Mode

I’m going to do periodic analysis of my Emacs use, to better determine how I might more efficiently use it. I expect the frequency of command to change dramatically every few months, as what I use emacs for changes. For example, right now I mostly use emacs for writing blog posts, customizing emacs itself, and a small amount of programming that I do on my free time. This will no doubt change when I go back for my school term and will have many more programming projects.

To analyze my frequency, I need to keep track of what commands I am executing. Searching around found the comnmand-frequency package, originally used to develop an ergonomic keybinding set for emacs. This package can be found here. To enable command tracking, put the following in your initialization file:

(setq-default command-frequency-table-file "~/.emacs.d/frequencies")
(require 'command-frequency)
(command-frequency-table-load)
(command-frequency-mode 1)
(command-frequency-autosave-mode 1)

This will make the command frequency tracking persistent across your emacs sessions, as well. If you want this to happen, you need to set the command-frequency-table-file before loading the table and do that before enabling autosave-mode; otherwise, as I’ve found out, you’ll probably lose your old history. There are a few additional customizations you can make to specify where various files are saved and what format they are written in, but I find this sufficient.

Once you’re enabled command-frequency-mode, it’s very simple to use. M-x command-frequency will take you to a buffer showing the relative frequencies of all your commands. M-x command-frequency-insert will insert this table into the current document. M-x write-file will *theoretically* write this information to a file, but unless called non-interactively it fails for me. I haven’t fixed this, since I haven’t ever had a need for it, but it would probably be a relatively simple fix.

Tags:

4 Responses to “Command-Frequency-Mode”

  1. James Brooks says:

    Interesting little task I have been tempted to do the same. I have found emacs to be such a wonderful program and I tend to use emacs and firefox for all tasks. Yet I find it’s initial state to be horribly antiquated, I know it’s customisable but I don’t think users should have to customise it to get an acceptable version.

    Keep us posted.

  2. Damyan says:

    Excellent! I was just thinking last night about how I needed something like this. I’m thinking of jumping ship to Visual Studio at some point (to get in line with my coworkers) and I wanted to know what commands I was likely to miss the most.

  3. Phil Hudson says:

    Very useful. Thanks!

  4. [...] all major Cloud …Rational Survivability – http://www.rationalsurvivability.com/blog/|||Command-Frequency-Mode « Musings of a Software Engineering StudentIf you want this to happen, you need to set the command-frequency-table-file before loading the [...]

Leave a Reply