X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=unsaved-buffers.el;h=6347e991635cef05c3c7827b59adbf0931f9400a;hb=fa5deaee2e0182ddfc7b39eea7ee2acedb259ddf;hp=15f0f5360d5644c7c860479c58cef78cf300836f;hpb=d6314e9fd15104b8b9db1f1c4b5f612a45d98a8a;p=distro-setup diff --git a/unsaved-buffers.el b/unsaved-buffers.el index 15f0f53..6347e99 100644 --- a/unsaved-buffers.el +++ b/unsaved-buffers.el @@ -1,20 +1,25 @@ ;; print buffers unsaved, unless within "seconds" below -;; run with -;; emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)" | sed 's/^..//;s/..$//' - +;; for example running, see system-stat (format "%s" (-reduce-from (lambda (acc buf) - (let ((seconds 60) - (bpath (buffer-file-name buf))) + (let ((bpath (buffer-file-name buf))) (if (and bpath - (buffer-modified-p buf) - (time-less-p - (file-attribute-modification-time (file-attributes bpath)) - (time-add (current-time) (- seconds)))) + (buffer-modified-p buf)) (cons bpath acc ) acc))) nil (buffer-list)) ) + +;; put into +;; (format "%s" (-reduce-from (lambda (acc buf) (let ((bpath (buffer-file-name buf))) (if (and bpath (buffer-modified-p buf)) (cons bpath acc ) acc))) nil (buffer-list))) + + +;; +;; Previously, I used a condition to check only for files not saved +;; which had mod times > 60 seconds. However, using it my system status +;; script meant stating a lot of files over and over, which eventually +;; caused some lag, so I abandoned it. +;;