-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecord.el
36 lines (28 loc) · 1.14 KB
/
record.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;; change-major-mode-hook
;; after-change-major-mode-hook
;; (command-history)
;; (list-command-history)
;; pre-command-hook
;; post-command-hook
(setq rubykaigidribble "rubykaigidribble.txt")
(create-file-buffer rubykaigidribble)
;; for now user will have to save dribble
(defun track-command-executed ()
"Records command executed and keys pressed"
(with-current-buffer rubykaigidribble
(insert (format "cmd: %s keys %s\n" this-command (this-command-keys)))))
;;(write-file rubykaigidribble) ))
(defun track-mode-change ()
"Record the major mode and all minor-modes activated"
(with-current-buffer rubykaigidribble
(insert (format "major-mode: %s\nminor-modes: %s\n\n" major-mode minor-mode-list))
(write-file rubykaigidribble) ))
;; Not sure why, but setting these as a defun only winds up executing
;; the last hook.
(progn
(add-hook 'pre-command-hook 'track-command-executed))
;; change mode only shows fundamental mode...
;;(add-hook 'after-change-major-mode-hook 'track-mode-change))
(progn
(remove-hook 'pre-command-hook 'track-command-executed)
(remove-hook 'after-change-major-mode-hook 'track-mode-change))