|
[Nov. 2nd, 2004|12:52 am]
Jason
|
Wrote a emacs minor mode for automatically storing my current wordcount to a file with a time stamp, as suggested by tom7. This may be not very idiomatic elisp, being as I am not very experienced with it. I had to jump out to perl to acutally, gasp, deal with numbers larger than 2 to the 27.
Elisp:
(defun nano-data ()
(set-buffer (find-file-noselect "wordcount-history"))
(goto-char (point-max))
(let* ((tm (current-time))
(str1 (int-to-string (car tm)))
(str2 (int-to-string (cadr tm)))
(shellcmd (concat "wc -w 2004-*.tex | tail -1 | perl -lane 'print ((" str1 " * 65536 + " str2 ") . \" $F[0]\" )' ")))
(insert (shell-command-to-string shellcmd)))
(basic-save-buffer))
(define-minor-mode nanowri-mode
"just an after-save-hook hack for now"
nil
"NaNoWriMo"
nil
(if nanowri-mode
(add-hook 'after-save-hook 'nano-data nil t)
(remove-hook 'after-save-hook 'nano-data)))
Gnuplot:
set terminal x11 persist
plot "wordcount-history" using ($1 / 1000 - 1.09928e6):($2) with lines notitle
|
|