[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to protect a buffer from being deleted by accident?
From: |
Phillip Lord |
Subject: |
Re: How to protect a buffer from being deleted by accident? |
Date: |
05 Dec 2002 13:58:25 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.92 |
>>>>> "Adalbert" == Adalbert Perbandt <adalbert.perbandt@infineon.com> writes:
Adalbert> Hi there,
Adalbert> At my site we're using clearcase mode (clearcase.el) for a
Adalbert> long time with very few problems. Some time ago one of our
Adalbert> users deleted the buffer "*clearcase*" inadvertently.
Adalbert> Now I'd like to provide a simple mechanism which disallows
Adalbert> for deletion of this buffer. I think, it would not be too
Adalbert> complex to implement this but I don't know any simple
Adalbert> method to get it done. Maybe there is a posibility to mark
Adalbert> a specific buffer as "undeletable" or so.
Adalbert> Any hints are welcome.
There is a kill buffer hook, and also a variable called
"kill-buffer-query-functions". You could put something in there.
So it would go something like
(defun clearcase-query-function()
(interactive)
(y-or-n-p "Really kill this buffer"))
(add-hook 'clearcase-mode-hook
(lambda()
(interactive)
(make-local-variable 'kill-buffer-query-functions)
(add-to-list 'kill-buffer-query-functions
'clearcase-query-function)))
I don't have a copy of clearcase.el around, so I don't know if
clearcase-mode-hook is right or not. There should be something similar
though.
Cheers
Phil