[R] Prevent killing an ESS *R* buffer unintentionally

rijn@swi.psy.uva.nl rijn at swi.psy.uva.nl
Fri Feb 23 16:53:48 CET 2001

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

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.)



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

More information about the R-help mailing list