;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:20:58 2007 ;;; from file /home/cyd/emacs/lisp/midnight.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`midnight.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\207" [require timer custom-declare-group midnight nil "Run something every day at midnight." :group calendar :version "20.3"] 8) #@166 Timer running the `midnight-hook' `midnight-delay' seconds after midnight. Use `cancel-timer' to stop it and `midnight-delay-set' to change the time when it is run. (defvar midnight-timer nil (#$ . 753)) #@173 *Non-nil means run `midnight-hook' at midnight. Setting this variable outside customize has no effect; call `cancel-timer' or `timer-activate' on `midnight-timer' instead. (custom-declare-variable 'midnight-mode 'nil '(#$ . -964) :type 'boolean :group 'midnight :require 'midnight :initialize 'custom-initialize-default :set #[(symb val) " L\210\303\304!\210 \203\305\n!\207\306\n!\207" [symb val midnight-timer require midnight timer-activate cancel-timer] 2]) #@76 Convert the float number of seconds since epoch to the list of 3 integers. (defalias 'midnight-time-float #[(num) "\303\304\305\"\306 \"\211\306 \307!\n_Z!\310\311 \304\"\312_!E*\207" [div num 1st ash 1 16 floor float round mod 10000000] 7 (#$ . 1435)]) #@63 Return the time-stamp of BUFFER, or current buffer, as float. (defalias 'midnight-buffer-display-time #[(&optional buffer) "r\206pq\210 \205\302 !)\207" [buffer buffer-display-time float-time] 2 (#$ . 1699)]) #@335 *The number of days before any buffer becomes eligible for autokilling. The autokilling is done by `clean-buffer-list' when is it in `midnight-hook'. Currently displayed and/or modified (unsaved) buffers, as well as buffers matching `clean-buffer-list-kill-never-buffer-names' and `clean-buffer-list-kill-never-regexps' are excluded. (custom-declare-variable 'clean-buffer-list-delay-general '3 '(#$ . -1920) :type 'integer :group 'midnight) #@243 *The number of seconds before some buffers become eligible for autokilling. Buffers matched by `clean-buffer-list-kill-regexps' and `clean-buffer-list-kill-buffer-names' are killed if they were last displayed more than this many seconds ago. (custom-declare-variable 'clean-buffer-list-delay-special '3600 '(#$ . -2369) :type 'integer :group 'midnight) #@553 *List of regexps saying which buffers will be killed at midnight. If buffer name matches a regexp in the list and the buffer was not displayed in the last `clean-buffer-list-delay-special' seconds, it is killed by `clean-buffer-list' when is it in `midnight-hook'. If a member of the list is a cons, its `car' is the regexp and its `cdr' is the number of seconds to use instead of `clean-buffer-list-delay-special'. See also `clean-buffer-list-kill-buffer-names', `clean-buffer-list-kill-never-regexps' and `clean-buffer-list-kill-never-buffer-names'. (custom-declare-variable 'clean-buffer-list-kill-regexps 'nil '(#$ . -2729) :type '(repeat (regexp :tag "Regexp matching Buffer Name")) :group 'midnight) #@525 *List of strings saying which buffers will be killed at midnight. Buffers with names in this list, which were not displayed in the last `clean-buffer-list-delay-special' seconds, are killed by `clean-buffer-list' when is it in `midnight-hook'. If a member of the list is a cons, its `car' is the name and its `cdr' is the number of seconds to use instead of `clean-buffer-list-delay-special'. See also `clean-buffer-list-kill-regexps', `clean-buffer-list-kill-never-regexps' and `clean-buffer-list-kill-never-buffer-names'. (custom-declare-variable 'clean-buffer-list-kill-buffer-names ''("*Help*" "*Apropos*" "*Man " "*Buffer List*" "*Compile-Log*" "*info*" "*vc*" "*vc-diff*" "*diff*") '(#$ . -3442) :type '(repeat (string :tag "Buffer Name")) :group 'midnight) #@326 *List of buffer names which will never be killed by `clean-buffer-list'. See also `clean-buffer-list-kill-never-regexps'. Note that this does override `clean-buffer-list-kill-regexps' and `clean-buffer-list-kill-buffer-names' so a buffer matching any of these two lists will NOT be killed if it is also present in this list. (custom-declare-variable 'clean-buffer-list-kill-never-buffer-names ''("*scratch*" "*Messages*" "*server*") '(#$ . -4213) :type '(repeat (string :tag "Buffer Name")) :group 'midnight) #@375 *List of regexp saying which buffers will never be killed at midnight. See also `clean-buffer-list-kill-never-buffer-names'. Killing is done by `clean-buffer-list'. Note that this does override `clean-buffer-list-kill-regexps' and `clean-buffer-list-kill-buffer-names' so a buffer matching any of these two lists will NOT be killed if it also matches anything in this list. (custom-declare-variable 'clean-buffer-list-kill-never-regexps ''("^ \\*Minibuf-.*\\*$") '(#$ . -4729) :type '(repeat (regexp :tag "Regexp matching Buffer Name")) :group 'midnight) #@55 A stopgap solution to the absence of `find' in ELisp. (defalias 'midnight-find #[(el ls test &optional key) "\300\301\215\207" [--cl-block-nil-- (byte-code "\306\211\203(\n@ \f\203\f !\202 \"\203!\307\310 \"\210\nA\211\204*\306\207" [ls rr #1=#:--cl-dolist-temp-- test key el nil throw --cl-block-nil--] 4)] 2 (#$ . 5290)]) #@261 Return the delay, in seconds, before killing a buffer named NAME. Uses `clean-buffer-list-kill-buffer-names', `clean-buffer-list-kill-regexps' `clean-buffer-list-delay-general' and `clean-buffer-list-delay-special'. Autokilling is done by `clean-buffer-list'. (defalias 'clean-buffer-list-delay #[(name) "\305 \306\n$\206\305 \307\n$\206\f\310_\207" [name clean-buffer-list-kill-buffer-names clean-buffer-list-delay-special clean-buffer-list-kill-regexps clean-buffer-list-delay-general assoc-default string= string-match 86400] 5 (#$ . 5635)]) #@564 Kill old buffers that have not been displayed recently. The relevant variables are `clean-buffer-list-delay-general', `clean-buffer-list-delay-special', `clean-buffer-list-kill-buffer-names', `clean-buffer-list-kill-never-buffer-names', `clean-buffer-list-kill-regexps' and `clean-buffer-list-kill-never-regexps'. While processing buffers, this procedure displays messages containing 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. (defalias 'clean-buffer-list #[nil "\306 \307\310\311!\307\211\211\312 \307\211\203\227@\313!\203\216\314!\315!\f\203: \fZ\202;\316\317!\320\321 \f\205K\322\n! %\210\323\324#\204\216\323 \325#\204\216\326!\204\216\327!\203u\330!\204\216\331\332\"\204\216\n W\204\216\320\333 #\210\334!\210A\211\204.\307\207" [bn cbld delay ts bts tm float-time nil format-time-string "%Y-%m-%d %T" buffer-list buffer-live-p midnight-buffer-display-time buffer-name 0 clean-buffer-list-delay message "[%s] `%s' [%s %d]" round midnight-find string-match string-equal get-buffer-process buffer-file-name buffer-modified-p get-buffer-window visible "[%s] killing `%s'" kill-buffer buf #1=#:--cl-dolist-temp-- clean-buffer-list-kill-never-regexps clean-buffer-list-kill-never-buffer-names] 7 (#$ . 6193) nil]) #@65 The number of seconds in a day--the delta for `midnight-timer'. (defvar midnight-period (+ 86400 0) (#$ . 7612)) #@107 The hook run `midnight-delay' seconds after midnight every day. The default value is `clean-buffer-list'. (custom-declare-variable 'midnight-hook ''(clean-buffer-list) '(#$ . 7732) :type 'hook :group 'midnight) #@54 Return the number of seconds till the next midnight. (defalias 'midnight-next #[nil "\304 \211@A@\3058\306\307\\ \310_Z\n\311_Z Z,\207" [#1=#:--cl-var-- sec min hrs decode-time 2 86400 0 3600 60] 4 (#$ . 7949)]) #@152 Modify `midnight-timer' according to `midnight-delay'. Sets the first argument SYMB (which must be symbol `midnight-delay') to its second argument TM. (defalias 'midnight-delay-set #[(symb tm) "\304=\204 \305\306\"\210 L\210\307\n!\203\310\n!\210\311 \247\203&\312 \\\202' \313\314$\211\207" [symb tm midnight-timer midnight-period midnight-delay error "Invalid argument to `midnight-delay-set': `%s'" timerp cancel-timer run-at-time midnight-next run-hooks midnight-hook] 5 (#$ . 8174)]) #@295 *The number of seconds after the midnight when the `midnight-timer' is run. You should set this variable before loading midnight.el, or set it by calling `midnight-delay-set', or use `custom'. If you wish, you can use a string instead, it will be passed as the first argument to `run-at-time'. (custom-declare-variable 'midnight-delay '3600 '(#$ . -8681) :type 'sexp :set 'midnight-delay-set :group 'midnight) (provide 'midnight)