rijn@swi.psy.uva.nl
2001-Feb-23 15:53 UTC
[R] Prevent killing an ESS *R* buffer unintentionally
A couple of days ago I posted some elisp code that asks the user for confirmation before deleting a process buffer, e.g. the *R* buffer. However, this code was only evaluated if a buffer was killed by means of [C-x k]. The following code does not need to be bound to a particular key, it's internally called by kill-buffer. (Also works if buffer is deleted in other ways, e.g., [C-x C-c].) (defun h-kill-buffer-query-function () (or (not (get-buffer-process (buffer-name))) (yes-or-no-p (format "Kill process associated with %s? " (buffer-name))))) (add-hook 'kill-buffer-query-functions 'h-kill-buffer-query-function) Probably, this functionality already exists in emacs but after searching for some time, it seemed faster to write it myself. (That is, I copy-paste-and-adapted it from gnuserv.el.) Groet, Hedderik. -- http://swipc30.swi.psy.uva.nl/~rijn -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._