X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/1658b4014f884a5bee07acdebc02774780957735..4ed1626da6e9f060129808273b7b94e3d4f69dc9:/lisp/midnight.el diff --git a/lisp/midnight.el b/lisp/midnight.el index 762bc5445b..40e66b8ce9 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el @@ -1,6 +1,6 @@ ;;; midnight.el --- run something every midnight, e.g., kill old buffers -;; Copyright (C) 1998, 2001-2011 Free Software Foundation, Inc. +;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc. ;; Author: Sam Steingold ;; Maintainer: Sam Steingold @@ -36,8 +36,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl-lib)) (defgroup midnight nil "Run something every day at midnight." @@ -138,9 +137,9 @@ two lists will NOT be killed if it also matches anything in this list." (defun midnight-find (el ls test &optional key) "A stopgap solution to the absence of `find' in ELisp." - (dolist (rr ls) + (cl-dolist (rr ls) (when (funcall test (if key (funcall key rr) rr) el) - (return rr)))) + (cl-return rr)))) (defun clean-buffer-list-delay (name) "Return the delay, in seconds, before killing a buffer named NAME. @@ -196,8 +195,7 @@ The default value is `clean-buffer-list'." (defun midnight-next () "Return the number of seconds till the next midnight." - (multiple-value-bind (sec min hrs) - (values-list (decode-time)) + (pcase-let ((`(,sec ,min ,hrs) (decode-time))) (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec))) ;;;###autoload @@ -205,8 +203,8 @@ The default value is `clean-buffer-list'." "Modify `midnight-timer' according to `midnight-delay'. Sets the first argument SYMB (which must be symbol `midnight-delay') to its second argument TM." - (assert (eq symb 'midnight-delay) t - "Invalid argument to `midnight-delay-set': `%s'") + (cl-assert (eq symb 'midnight-delay) t + "Invalid argument to `midnight-delay-set': `%s'") (set symb tm) (when (timerp midnight-timer) (cancel-timer midnight-timer)) (setq midnight-timer