unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
Subject: Re: Kill other buffers
Date: Mon, 12 Dec 2005 21:35:30 +0100	[thread overview]
Message-ID: <dnkmif$7l9$1@online.de> (raw)
In-Reply-To: mailman.18999.1134409322.20277.help-gnu-emacs@gnu.org

Kevin Rodgers wrote:

> Pedro Sa da Costa wrote:
>> Suppose that i have 3 files opened in emacs.
>> 
>> Now, i'm in file 1 and i want to close file 2 and file 3. There is any
>> short- key to close (kill) other buffers opened, while i'm in file 1?
> 
> Try `M-x electric-buffer-list'.  I prefer it to list-buffers, so I
> override the default binding:
> 
> (global-set-key "\C-x\C-b" 'electric-buffer-list)
> 

Right, or try that:

(defun kill-all-buffers (&optional arg)
  "with arg, save all buffers before deleting them"
  (interactive "P")
  (if arg
      (save-some-buffers))
  (let ((pufferliste (buffer-list)))
    (while pufferliste
      (progn
        (if (not (equal (car pufferliste) (current-buffer)))
            (kill-buffer (car pufferliste)))
        (setq pufferliste (cdr pufferliste))))))

;; make a key at `C-c k' 
(global-set-key "\C-ck" 'kill-all-buffers)

ar

  parent reply	other threads:[~2005-12-12 20:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-11 17:52 Kill other buffers Pedro Sa da Costa
2005-12-12 16:52 ` Kevin Rodgers
     [not found] ` <mailman.18999.1134409322.20277.help-gnu-emacs@gnu.org>
2005-12-12 20:35   ` Andreas Röhler [this message]
2005-12-13  8:15     ` Alan Mackenzie
     [not found] <mailman.18814.1134323599.20277.help-gnu-emacs@gnu.org>
2005-12-11 21:08 ` roodwriter
2005-12-12  6:25   ` Xiangqian Liu
2005-12-12  6:47     ` Drew Adams
2005-12-12 12:06 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dnkmif$7l9$1@online.de' \
    --to=andreas.roehler@online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).