home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
me34src.zip
/
me3
/
mutt
/
builtin
/
delbuf.mut
< prev
next >
Wrap
Text File
|
1995-01-14
|
1KB
|
40 lines
;; delbuf.mut : Dispose of a buffer, by name.
;; Default is current buffer.
;; If a window is displaying the buffer to be deleted, delete that
;; window.
;; C Durland Public Domain
(include me.mh)
(defun
delete-buffer
{
(string name)(int j n buf-id)
(name (complete CC_BUF "Delete buffer: "))
(if (== name "") (buf-id (current-buffer)) ;; use the default
(if (== -2 (buf-id (attached-buffer name)))
{ (msg '"' name '" is not a buffer.')(done) }))
;; Ask before we delete a modified buffer we care about
(if (and
(== BFModified ;; Check to see if we care about this buffer
(bit-and (buffer-flags buf-id) (bit-or BFModified BFNoCare)))
(not (yesno (buffer-name buf-id) " has changed. Delete anyway")))
(done)) ;; They don't want to delete it
(if (arg-flag)
{
;; remove all windows displaying buffer to be deleted
;; (unless its the only one left).
(n 0)
(while (and (< n (windows))(> (windows) 1))
{
(if (== buf-id (attached-buffer n)) { (free-window n) (continue) } )
(+= n 1)
})
})
(free-buffer buf-id) ;; Kiss that sucka goodbye
}
)