summaryrefslogtreecommitdiff
path: root/lisp/midnight.el
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2016-10-15 23:27:46 -0400
committerSam Steingold <sds@gnu.org>2016-10-15 23:27:46 -0400
commitf9cbe8ee63f911650dcd273cb980eed5b8f58396 (patch)
tree79bc56625ef9f19e665cdefd48028fddd4d5a1f7 /lisp/midnight.el
parentcd726ef68ece4fff6772bd08c0051c294e925505 (diff)
downloademacs-f9cbe8ee63f911650dcd273cb980eed5b8f58396.tar.gz
use full time objects (lists) instead of floats when possible
* midnight.el (midnight-buffer-display-time): Remove (clean-buffer-list): Use float time only for time comparison
Diffstat (limited to 'lisp/midnight.el')
-rw-r--r--lisp/midnight.el32
1 files changed, 14 insertions, 18 deletions
diff --git a/lisp/midnight.el b/lisp/midnight.el
index 878c5a7f71f..814621fc4e3 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -60,13 +60,6 @@ the time when it is run.")
(when (timerp midnight-timer) (cancel-timer midnight-timer))
(if midnight-mode (timer-activate midnight-timer)))
-;;; time conversion
-
-(defun midnight-buffer-display-time (buffer)
- "Return the time-stamp of BUFFER, or current buffer, as float."
- (with-current-buffer buffer
- (when buffer-display-time (float-time buffer-display-time))))
-
;;; clean-buffer-list stuff
(defcustom clean-buffer-list-delay-general 3
@@ -167,25 +160,28 @@ the current date/time, buffer name, how many seconds ago it was
displayed (can be nil if the buffer was never displayed) and its
lifetime, i.e., its \"age\" when it will be purged."
(interactive)
- (let ((tm (float-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
+ (let ((tm (current-time)) bts (ts (format-time-string "%Y-%m-%d %T"))
delay cbld bn)
(dolist (buf (buffer-list))
(when (buffer-live-p buf)
- (setq bts (midnight-buffer-display-time buf) bn (buffer-name buf)
- delay (if bts (- tm bts) 0) cbld (clean-buffer-list-delay bn))
- (message "[%s] `%s' [%s %d]" ts bn (if bts (round delay)) cbld)
- (unless (or (cl-find bn clean-buffer-list-kill-never-regexps
+ (setq bts (with-current-buffer buf buffer-display-time)
+ bn (buffer-name buf)
+ delay (if bts (round (float-time (time-subtract tm bts))) 0)
+ cbld (clean-buffer-list-delay bn))
+ (message "[%s] `%s' [%s %d]" ts bn delay cbld)
+ (unless (or (cl-find bn clean-buffer-list-kill-never-regexps
:test (lambda (bn re)
(if (functionp re)
(funcall re bn)
(string-match re bn))))
- (cl-find bn clean-buffer-list-kill-never-buffer-names
+ (cl-find bn clean-buffer-list-kill-never-buffer-names
:test #'string-equal)
- (get-buffer-process buf)
- (and (buffer-file-name buf) (buffer-modified-p buf))
- (get-buffer-window buf 'visible) (< delay cbld))
- (message "[%s] killing `%s'" ts bn)
- (kill-buffer buf))))))
+ (get-buffer-process buf)
+ (and (buffer-file-name buf) (buffer-modified-p buf))
+ (get-buffer-window buf 'visible)
+ (< delay cbld))
+ (message "[%s] killing `%s'" ts bn)
+ (kill-buffer buf))))))
;;; midnight hook