improvements
[distro-setup] / unsaved-buffers.el
1 ;; print buffers unsaved, unless within "seconds" below
2
3 ;; run with
4 ;; emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)" | sed 's/^..//;s/..$//'
5
6
7 (format "%s"
8 (-reduce-from
9 (lambda (acc buf)
10 (let ((seconds 60)
11 (bpath (buffer-file-name buf)))
12 (if (and bpath
13 (buffer-modified-p buf)
14 (time-less-p
15 (file-attribute-modification-time (file-attributes bpath))
16 (time-add (current-time) (- seconds))))
17 (cons bpath acc )
18 acc)))
19 nil (buffer-list))
20 )