Manoj Rao bio photo

Manoj Rao

Your Average Common Man

Email Twitter Github


Emacs offers you extreme configurability without depending solely on pre-defined functions and variables. Perhaps, the most significant characteristic of vim is its blazing speed and almost no burden from adding bells and whistles. And one of my favorite features in Vim is the relative numbering of the lines. This allows you to almost instantly use Vim’s commands with lines/numbers as arguments. In the code snippet below (Linux Kernel), say, you wanted to remove the comment with “TODO” since the comment is no longer valid in the context. You do not have to start calculating

void update_rq_clock(struct rq *rq)
        s64 delta;


        if (rq->clock_update_flags & RQCF_ACT_SKIP)

        /* TODO: add config sched debug warning */
        if (sched_feat(WARN_DOUBLE_CLOCK))
                SCHED_WARN_ON(rq->clock_update_flags & RQCF_UPDATED);
        rq->clock_update_flags |= RQCF_UPDATED;

        delta = sched_clock_cpu(cpu_of(rq)) - rq->clock;
        if (delta < 0)
        rq->clock += delta;
        update_rq_clock_task(rq, delta);

Voidstar Podcast:

This came out my interview for the VoidStar Podcast Series with Joe Armstrong.


The idea is to track your activity via Emacs. Given that Emacs is more of “an OS that lacks a good editor” this is actually possible.


Here I give you the outline of how to setup your Emacs system so that you can try and track your activity too.


The primary idea is to track which file you have been spending the most time on per week.


For this you will need an Emacs plugin that can keep track of when you opened a file and when you closed it.

Emacs Config:

Here’s my code to do this, but before that, I have to disclose that a part of this code was lifted from some response to StackOverflow question etc.


Emacs Lisp:

This does not handle closing Emacs altogether, and killing Emacs all of a sudden. Frankly neither of these are an occurence in my system. So here goes.

;;;;;;;;;;;;; My edits to track the files I use
(add-hook 'before-save-hook 'time-stamp)

(defvar my-m-x-log-file "~/mx.log")
;; (defadvice execute-extended-command (after log-execute-extended-command activate)
;;   (let ((logfile (find-file-noselect my-m-x-log-file)))
;;     (with-current-buffer logfile
;;       (goto-char (point-max))
;;       (insert (format "%s %s\n" this-command 'insert-time-stamp))
;;       (save-buffer))))
(defvar current-date-time-format "%a %b %d %H:%M:%S %Z %Y")
(add-hook 'find-file-hook 'my-fileopen-hook)
(defun my-fileopen-hook()
  (setq my-buf-name (buffer-file-name))
  (let ((logfile (find-file-noselect my-m-x-log-file)))
  (with-current-buffer logfile
  (goto-char (point-max))
  (insert (format "[+] %s " my-buf-name))
  (insert (format-time-string current-date-time-format (current-time)))
  (insert "\n")

(add-hook 'kill-buffer-hook 'my-fileclose-hook)
(defun my-fileclose-hook()
  (setq my-buf-name (buffer-file-name))
  (let ((logfile (find-file-noselect my-m-x-log-file)))
  (with-current-buffer logfile
  (goto-char (point-max))
  (insert (format "[-] %s " my-buf-name))
  (insert (format-time-string current-date-time-format (current-time)))
  (insert "\n")