2013-06-19

using emacs to manage temporary files during debugging





a.lisp



We always need some temporary files to do editing work.
for example, we got 10000+ line logs to trace bug in it, first thing to do is create a tmp file.

1. To create a tmp file we'd like to
- quick open the files in a directory without naming collision, with short-key `C-; t`
- store the tmp files for future search/grep

;;code
    (defun create-and-open-tmp-file ()
      (interactive)
      (find-file (s-concat
              "~/Documents/hongmin.wang/Google Drive/notes/tmp"
              (format-time-string "%Y%m%d___%H_%M_%S")
              (uuid-string)
              ".temp")))
    (global-set-key (kbd "C-; t") 'create-and-open-tmp-file)

2. To manage versions of tmp file, we like to put it in a git direcotry
   and `C-x v i` to register the tmp file to git
   and `C-x v v` to commit new version of the tmp file to git.

3. sometime, you think the tmp file is no longer an tmp file,
   do a "Save As..." by `C-x C-w`