aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-08-04 05:36:07 +0000
committerRichard M. Stallman1998-08-04 05:36:07 +0000
commitb2f9ab3cf5b1b775015bb6ae2fb68aac326737c5 (patch)
tree15ac4051dbe46e66f3c497ee3fd3511aab24c208
parentd81724c7776aaeffbd9dea5b8c3833c297603c5b (diff)
downloademacs-b2f9ab3cf5b1b775015bb6ae2fb68aac326737c5.tar.gz
emacs-b2f9ab3cf5b1b775015bb6ae2fb68aac326737c5.zip
(clean-buffer-list-kill-regexps): Init to nil, as before.
(clean-buffer-list-kill-buffer-names): Add *vc* and *vc-diff*. (clean-buffer-list-delay): Rename arg. (clean-buffer-list): Doc fix. (midnight-period): Doc fix.
-rw-r--r--lisp/midnight.el32
1 files changed, 9 insertions, 23 deletions
diff --git a/lisp/midnight.el b/lisp/midnight.el
index fd9867daaaa..ba68718bde9 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -95,7 +95,7 @@ displayed more than this many seconds ago."
95 :type 'integer 95 :type 'integer
96 :group 'midnight) 96 :group 'midnight)
97 97
98(defcustom clean-buffer-list-kill-regexps '("\\*vc\\.") 98(defcustom clean-buffer-list-kill-regexps nil
99 "*List of regexps saying which buffers will be killed at midnight. 99 "*List of regexps saying which buffers will be killed at midnight.
100If buffer name matches a regexp in the list and the buffer was not displayed 100If buffer name matches a regexp in the list and the buffer was not displayed
101in the last `clean-buffer-list-delay-special' seconds, it is killed by 101in the last `clean-buffer-list-delay-special' seconds, it is killed by
@@ -109,7 +109,8 @@ See also `clean-buffer-list-kill-buffer-names',
109 :group 'midnight) 109 :group 'midnight)
110 110
111(defcustom clean-buffer-list-kill-buffer-names 111(defcustom clean-buffer-list-kill-buffer-names
112 '("*Help*" "*Apropos*" "*Man " "*Buffer List*" "*Compile-Log*" "*info*") 112 '("*Help*" "*Apropos*" "*Man " "*Buffer List*" "*Compile-Log*" "*info*"
113 "*vc*" "*vc-diff*")
113 "*List of strings saying which buffers will be killed at midnight. 114 "*List of strings saying which buffers will be killed at midnight.
114Buffers with names in this list, which were not displayed in the last 115Buffers with names in this list, which were not displayed in the last
115`clean-buffer-list-delay-special' seconds, are killed by `clean-buffer-list' 116`clean-buffer-list-delay-special' seconds, are killed by `clean-buffer-list'
@@ -151,34 +152,19 @@ two lists will NOT be killed if it also matches anything in this list."
151 (when (funcall test el (if key (funcall key rr) rr)) 152 (when (funcall test el (if key (funcall key rr) rr))
152 (return rr))))) 153 (return rr)))))
153 154
154(defun assoc-default (el alist test default) 155(defun clean-buffer-list-delay (name)
155 "Find object EL in a pseudo-alist ALIST. 156 "Return the delay, in seconds, before killing a buffer named NAME.
156ALIST is a list of conses or objects. EL is compared (using TEST) with
157CAR (or the object itself, if it is not a cons) of elements of ALIST.
158When TEST returns non-nil, CDR (or DEFAULT, if the object is not a cons)
159of the object is returned.
160This is a non-consing analogue of
161 (cdr (assoc el (mapcar (lambda (el) (if (consp el) el (cons el default)))
162 alist)
163 :test test))
164The calling sequence is: (ASSOC-DEFAULT EL ALIST TEST DEFAULT)"
165 (dolist (rr alist)
166 (when (funcall test el (if (consp rr) (car rr) rr))
167 (return (if (consp rr) (cdr rr) default)))))
168
169(defun clean-buffer-list-delay (bn)
170 "Return the delay, in seconds, before this buffer name is auto-killed.
171Uses `clean-buffer-list-kill-buffer-names', `clean-buffer-list-kill-regexps' 157Uses `clean-buffer-list-kill-buffer-names', `clean-buffer-list-kill-regexps'
172`clean-buffer-list-delay-general' and `clean-buffer-list-delay-special'. 158`clean-buffer-list-delay-general' and `clean-buffer-list-delay-special'.
173Autokilling is done by `clean-buffer-list'." 159Autokilling is done by `clean-buffer-list'."
174 (or (assoc-default bn clean-buffer-list-kill-buffer-names 'string= 160 (or (assoc-default name clean-buffer-list-kill-buffer-names 'string=
175 clean-buffer-list-delay-special) 161 clean-buffer-list-delay-special)
176 (assoc-default bn clean-buffer-list-kill-regexps 'string-match 162 (assoc-default name clean-buffer-list-kill-regexps 'string-match
177 clean-buffer-list-delay-special) 163 clean-buffer-list-delay-special)
178 (* clean-buffer-list-delay-general 24 60 60))) 164 (* clean-buffer-list-delay-general 24 60 60)))
179 165
180(defun clean-buffer-list () 166(defun clean-buffer-list ()
181 "Kill old buffers. 167 "Kill old buffers that have not been displayed recently.
182The relevant vartiables are `clean-buffer-list-delay-general', 168The relevant vartiables are `clean-buffer-list-delay-general',
183`clean-buffer-list-delay-special', `clean-buffer-list-kill-buffer-names', 169`clean-buffer-list-delay-special', `clean-buffer-list-kill-buffer-names',
184`clean-buffer-list-kill-never-buffer-names', 170`clean-buffer-list-kill-never-buffer-names',
@@ -200,7 +186,7 @@ The relevant vartiables are `clean-buffer-list-delay-general',
200;;; midnight hook 186;;; midnight hook
201 187
202(defvar midnight-period (* 24 60 60) 188(defvar midnight-period (* 24 60 60)
203 "The number of seconds in a day - the delta for `midnight-timer'.") 189 "The number of seconds in a day--the delta for `midnight-timer'.")
204 190
205(defcustom midnight-hook 'clean-buffer-list 191(defcustom midnight-hook 'clean-buffer-list
206 "The hook run `midnight-delay' seconds after midnight every day. 192 "The hook run `midnight-delay' seconds after midnight every day.