emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp subr.el


From: Juri Linkov
Subject: [Emacs-diffs] emacs/lisp subr.el
Date: Sat, 18 Jul 2009 21:05:47 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     09/07/18 21:05:47

Modified files:
        lisp           : subr.el 

Log message:
        (process-kill-buffer-query-function): New function.
        (add-hook)<kill-buffer-query-functions>: Add hook
        `process-kill-buffer-query-function'.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/subr.el?cvsroot=emacs&r1=1.641&r2=1.642

Patches:
Index: subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.641
retrieving revision 1.642
diff -u -b -r1.641 -r1.642
--- subr.el     14 Jul 2009 07:45:59 -0000      1.641
+++ subr.el     18 Jul 2009 21:05:47 -0000      1.642
@@ -1722,6 +1722,16 @@
     (set-process-query-on-exit-flag process nil)
     old))
 
+(defun process-kill-buffer-query-function ()
+  "Ask before killing a buffer that has a running process."
+  (let ((process (get-buffer-process (current-buffer))))
+    (or (not process)
+        (not (memq (process-status process) '(run stop open listen)))
+        (not (process-query-on-exit-flag process))
+        (yes-or-no-p "Buffer has a running process; kill it? "))))
+
+(add-hook 'kill-buffer-query-functions 'process-kill-buffer-query-function)
+
 ;; process plist management
 
 (defun process-get (process propname)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]