[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Killing Buffers
From: |
Friedrich Dominicus |
Subject: |
Re: Killing Buffers |
Date: |
Mon, 29 Dec 2003 07:27:32 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) |
Edward Wijaya <ewijaya@singnet.com.sg> writes:
> Hi,
>
> I am looking for a key that:
> 1. Kill all the existing buffer without having have to close Emacs
> 2. Kill all the existing buffer "except" the active one.
>
> Does anybody know the shortcut key for that?
Something like that could do the job
(require 'cl)
(defun kill-all-buffers-except (prefix)
(interactive "P")
(let ((cur-buf-name (buffer-name nil))
(buf-list (buffer-list)))
(when prefix
(setf buf-list (delete-if #'(lambda (buf)
(string= (buffer-name buf) cur-buf-name))
buf-list)))
(map 'nil #'kill-buffer buf-list)))
You can bind it to whatever key you like.
If you give it prefix C-u than all but the current buffer is
killed. Otherwise all is killed but one buffer. One buffer is open all
the time.
Regards
Friedrich