Annotation-System/source_recorder/source-recorder.el

35 lines
759 B
EmacsLisp

(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)
(defun buffer-switchs-recorder ()
;(append-to-file
(message
(format "%s;%s;%s\n"
(buffer-file-name)
(format-time-string "%s")
(format "S;%s;%s" (selected-window) (buffer-name))
)
; nil "~/test.log"
)
)
(add-hook 'buffer-list-update-hook 'buffer-switchs-recorder)