Commit 73ba610a authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(kill-some-buffers): New arg LIST says buffers to maybe kill.

parent 5b6575b7
...@@ -2378,22 +2378,24 @@ This command is used in the special Dired buffer created by ...@@ -2378,22 +2378,24 @@ This command is used in the special Dired buffer created by
(message "No files can be recovered from this session now"))) (message "No files can be recovered from this session now")))
(kill-buffer buffer)))) (kill-buffer buffer))))
(defun kill-some-buffers () (defun kill-some-buffers (&optional list)
"For each buffer, ask whether to kill it." "For each buffer in LIST, ask whether to kill it.
LIST defaults to all existing live buffers."
(interactive) (interactive)
(let ((list (buffer-list))) (if (null list)
(while list (setq list (buffer-list)))
(let* ((buffer (car list)) (while list
(name (buffer-name buffer))) (let* ((buffer (car list))
(and (not (string-equal name "")) (name (buffer-name buffer)))
(/= (aref name 0) ? ) (and (not (string-equal name ""))
(yes-or-no-p (/= (aref name 0) ? )
(format "Buffer %s %s. Kill? " (yes-or-no-p
name (format "Buffer %s %s. Kill? "
(if (buffer-modified-p buffer) name
"HAS BEEN EDITED" "is unmodified"))) (if (buffer-modified-p buffer)
(kill-buffer buffer))) "HAS BEEN EDITED" "is unmodified")))
(setq list (cdr list))))) (kill-buffer buffer)))
(setq list (cdr list))))
(defun auto-save-mode (arg) (defun auto-save-mode (arg)
"Toggle auto-saving of contents of current buffer. "Toggle auto-saving of contents of current buffer.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment