adding source recording plugin for emacs and an example simple log file

This commit is contained in:
NJ 2017-06-10 20:48:18 +03:00
parent 95d0f63da0
commit d4cf614d5d
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,29 @@
/home/nicoco/.emacs.d/source-record.el;1497098576;A;464;a
/home/nicoco/.emacs.d/source-record.el;1497098577;A;465;s
/home/nicoco/.emacs.d/source-record.el;1497098577;A;466;d
/home/nicoco/.emacs.d/source-record.el;1497098577;A;467;f
/home/nicoco/.emacs.d/source-record.el;1497098577;D;467;468
/home/nicoco/.emacs.d/source-record.el;1497098578;D;464;467
/home/nicoco/.emacs.d/source-record.el;1497098578;D;463;464
/home/nicoco/.emacs.d/source-record.el;1497098899;A;402;
/home/nicoco/.emacs.d/source-record.el;1497098900;A;403;S
/home/nicoco/.emacs.d/source-record.el;1497098900;A;404;o
/home/nicoco/.emacs.d/source-record.el;1497098900;A;405;m
/home/nicoco/.emacs.d/source-record.el;1497098900;A;406;e
/home/nicoco/.emacs.d/source-record.el;1497098901;A;407;
/home/nicoco/.emacs.d/source-record.el;1497098901;A;408;e
/home/nicoco/.emacs.d/source-record.el;1497098901;A;409;d
/home/nicoco/.emacs.d/source-record.el;1497098901;A;410;i
/home/nicoco/.emacs.d/source-record.el;1497098901;A;411;t
/home/nicoco/.emacs.d/source-record.el;1497098901;A;412;i
/home/nicoco/.emacs.d/source-record.el;1497098902;A;413;n
/home/nicoco/.emacs.d/source-record.el;1497098902;A;414;g
/home/nicoco/.emacs.d/source-record.el;1497098904;A;415;
/home/nicoco/.emacs.d/source-record.el;1497098904;A;416;Some editing
/home/nicoco/.emacs.d/source-record.el;1497098908;A;428;
/home/nicoco/.emacs.d/source-record.el;1497098909;A;429;<
/home/nicoco/.emacs.d/source-record.el;1497098911;D;403;430
/home/nicoco/.emacs.d/source-record.el;1497098912;D;402;403
/home/nicoco/.emacs.d/source-record.el;1497098913;A;463;

View File

@ -0,0 +1,20 @@
(defun buffer-changes-recorder (change-beg change-end prev-len)
(append-to-file
;(message
(format "%s;%s;%s\n"
(buffer-file-name)
(format-time-string "%s")
(if (> prev-len 0)
(format "D;%d;%d"
change-beg
(+ change-beg prev-len))
(format "A;%d;%s"
change-beg
(buffer-substring change-beg change-end))
)
)
nil "~/test.log"
)
)
(add-hook 'after-change-functions 'buffer-changes-recorder)