help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resize remaining buffer after kill buffer


From: Joakim Hove
Subject: Re: resize remaining buffer after kill buffer
Date: Mon, 11 Aug 2003 14:34:33 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux)


Homunkulus@gmx.net (Torsten Müller) writes:


> Is there any simple way to enlarge one of the remaining buffers by the
> size of the just killed buffer?

Hello,

I don't know if this is what you want but:

(defun kill-buffer-and-window (BUFFER)
  "Kills a buffer and the accompanying window. If the buffer is not
displayed in the active frame nothing happens to the window 
configuration"
  (interactive "bKill buffer:")
  (let ((window))
    (if (> (count-windows) 1)
        (setq window (get-buffer-window BUFFER)))
    (kill-buffer BUFFER)
    (if window
        (delete-window window))))
    
does something alike.

*Warning* After writing this function I discovered that there already
exists a built in function with the same name, however It seems the
built function does not allow you to select which buffer to kill. In
my implementation nothing happens if you kill a buffer which does not
occupy a window in the current frame.

Joakim

-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]