all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to protect a buffer from being deleted by accident?
@ 2002-12-05 13:16 Adalbert Perbandt
  2002-12-05 13:58 ` Phillip Lord
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Adalbert Perbandt @ 2002-12-05 13:16 UTC (permalink / raw)


Hi there,

At my site we're using clearcase mode (clearcase.el) for a long time
with very few problems. Some time ago one of our users deleted the
buffer "*clearcase*" inadvertently.

Now I'd like to provide a simple mechanism which disallows for
deletion of this buffer. I think, it would not be too complex to
implement this but I don't know any simple method to get it
done. Maybe there is a posibility to mark a specific buffer as
"undeletable" or so.

Any hints are welcome.

Regards,

Adalbert Perbandt.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
  2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
@ 2002-12-05 13:58 ` Phillip Lord
  2002-12-05 14:38 ` Colin Marquardt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Phillip Lord @ 2002-12-05 13:58 UTC (permalink / raw)


>>>>> "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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
  2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
  2002-12-05 13:58 ` Phillip Lord
@ 2002-12-05 14:38 ` Colin Marquardt
  2002-12-05 15:22 ` Jesper Harder
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Colin Marquardt @ 2002-12-05 14:38 UTC (permalink / raw)


Adalbert Perbandt <adalbert.perbandt@infineon.com> writes:

> At my site we're using clearcase mode (clearcase.el) for a long time
> with very few problems. Some time ago one of our users deleted the
> buffer "*clearcase*" inadvertently.

This happens to me too, from time to time, but I see no adverse
effects. Maybe getting a newer version helps?

Cheers,
  Colin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
  2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
  2002-12-05 13:58 ` Phillip Lord
  2002-12-05 14:38 ` Colin Marquardt
@ 2002-12-05 15:22 ` Jesper Harder
  2002-12-05 15:36 ` Tom Capey
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jesper Harder @ 2002-12-05 15:22 UTC (permalink / raw)


Adalbert Perbandt <adalbert.perbandt@infineon.com> writes:

> Now I'd like to provide a simple mechanism which disallows for
> deletion of this buffer. I think, it would not be too complex to
> implement this but I don't know any simple method to get it
> done. Maybe there is a posibility to mark a specific buffer as
> "undeletable" or so.

There is 'protbuf.el'
<ftp://ftp.splode.com/pub/users/friedman/emacs-lisp/protbuf.el>

;;; Commentary:

;; This package allows you to make it harder to kill buffers accidentally,
;; e.g. by being too trigger happy selecting items in the buffer menu.
;; protect-process-buffer-from-kill-mode is perhaps the more useful of the
;; two, making it harder to accidentally kill shell buffers without
;; terminating the process in them first.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
  2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
                   ` (2 preceding siblings ...)
  2002-12-05 15:22 ` Jesper Harder
@ 2002-12-05 15:36 ` Tom Capey
  2002-12-06 19:43 ` Jeffery B. Rancier
       [not found] ` <mailman.1039203908.24681.help-gnu-emacs@gnu.org>
  5 siblings, 0 replies; 7+ messages in thread
From: Tom Capey @ 2002-12-05 15:36 UTC (permalink / raw)


* Adalbert Perbandt <adalbert.perbandt@infineon.com> writes:

> Hi there,
> At my site we're using clearcase mode (clearcase.el) for a long time
> with very few problems. Some time ago one of our users deleted the
> buffer "*clearcase*" inadvertently.

> Now I'd like to provide a simple mechanism which disallows for
> deletion of this buffer. I think, it would not be too complex to
> implement this but I don't know any simple method to get it
> done. Maybe there is a posibility to mark a specific buffer as
> "undeletable" or so.


(require 'emacs-lock)

`toggle-emacs-lock'

  or within code somewhere

(let ((buffer (get-buffer "*clearcase*")))
  (when buffer
    (set-buffer buffer)
    (setq emacs-lock-from-exiting nil)))

    something along those lines.


/Tom
-- 
"...and so, as the plastic duck of destiny has been sunk by the loofah
of fate, and Old Father Time has gone wrinkly in the bath water of
eternity, it must be time to pick out the short hairs of hope from the
plug hole of infinity."                                       -- Humph

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
  2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
                   ` (3 preceding siblings ...)
  2002-12-05 15:36 ` Tom Capey
@ 2002-12-06 19:43 ` Jeffery B. Rancier
       [not found] ` <mailman.1039203908.24681.help-gnu-emacs@gnu.org>
  5 siblings, 0 replies; 7+ messages in thread
From: Jeffery B. Rancier @ 2002-12-06 19:43 UTC (permalink / raw)


Adalbert Perbandt <adalbert.perbandt@infineon.com> writes:

> Hi there,
> 
> At my site we're using clearcase mode (clearcase.el) for a long time
> with very few problems. Some time ago one of our users deleted the
> buffer "*clearcase*" inadvertently.
> 
> Now I'd like to provide a simple mechanism which disallows for
> deletion of this buffer. I think, it would not be too complex to
> implement this but I don't know any simple method to get it
> done. Maybe there is a posibility to mark a specific buffer as
> "undeletable" or so.
> 
> Any hints are welcome.
> 
> Regards,
> 
> Adalbert Perbandt.

Have you looked at protbuf.el?  
http://www.splode.com/~friedman/software/emacs-lisp/src/protbuf.el

Jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to protect a buffer from being deleted by accident?
       [not found] ` <mailman.1039203908.24681.help-gnu-emacs@gnu.org>
@ 2002-12-11 17:48   ` Adalbert Perbandt
  0 siblings, 0 replies; 7+ messages in thread
From: Adalbert Perbandt @ 2002-12-11 17:48 UTC (permalink / raw)


Hi there,

thanks a lot for all the valuable hints!

In between I got informed about the location where I could download
recent versions of the clearcase-mode package. I did so and looked
into the most recent code. Now the problem with the *clearcase* buffer
is gone and the much more sensible *cleartool* buffer got a space as
first character added so it is no longer visible in the buffer
list. Obviously the author also saw good reasons to change this.

Thanks,

Adalbert.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-12-11 17:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-05 13:16 How to protect a buffer from being deleted by accident? Adalbert Perbandt
2002-12-05 13:58 ` Phillip Lord
2002-12-05 14:38 ` Colin Marquardt
2002-12-05 15:22 ` Jesper Harder
2002-12-05 15:36 ` Tom Capey
2002-12-06 19:43 ` Jeffery B. Rancier
     [not found] ` <mailman.1039203908.24681.help-gnu-emacs@gnu.org>
2002-12-11 17:48   ` Adalbert Perbandt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.