-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
38 lines (30 loc) · 1.06 KB
/
.emacs
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
37
38
;; update script thing
(define-key special-event-map [sigusr1]
(lambda ()
(interactive)
(revert-buffer t t)))
;; (save-buffer)))
(defun save-buffer-during-auto (&optional args)
"Save the current buffer for real during autosave"
(interactive)
(if (buffer-file-name)
(save-buffer)))
;;(add-hook 'auto-save-hook 'save-buffer-during-auto)
;;(add-hook 'post-command-hook 'save-buffer-during-auto) ;; updates even though nothing happens
(defvar last-post-command-position 0
"Holds the cursor position from the last run of post-command-hooks.")
(make-variable-buffer-local 'last-post-command-position)
(defun do-stuff-if-moved-post-command ()
(unless (equal (point) last-post-command-position)
(interactive)
(if (buffer-file-name)
(save-buffer)))
(setq last-post-command-position (point)))
(add-to-list 'post-command-hook 'do-stuff-if-moved-post-command)
;;; revert
(global-auto-revert-mode 1)
(setq revert-without-query '("*"))
(setq auto-revert-verbose nil)
;; Autosave like crazy
(setq auto-save-interval 1
auto-save-timeout 1)