]> git.eshelyaron.com Git - emacs.git/commitdiff
Kill channel buffers when killing rcirc server buffers
authorDeniz Dogan <deniz.a.m.dogan@gmail.com>
Wed, 11 Apr 2012 14:22:36 +0000 (16:22 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Wed, 11 Apr 2012 14:22:36 +0000 (16:22 +0200)
* net/rcirc.el (rcirc-kill-channel-buffers): New variable.
(rcirc-kill-buffer-hook): Use it to kill channel buffers.

Fixes: debbugs:5128
lisp/ChangeLog
lisp/net/rcirc.el

index e77cb1c820058ae18f4bf6758ec4c58da514432e..cde2c91be3d2df3e9a3ac76ca6602464d0dc87cd 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-11  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+       * net/rcirc.el (rcirc-kill-channel-buffers): New variable.
+       (rcirc-kill-buffer-hook): Use it to kill channel buffers (bug#5128).
+
 2012-04-11  William Stevenson  <yhvh2000@gmail.com>
 
        * textmodes/artist.el (artist-mode): Convert artist-mode to use
index 9d7e86645429ae4156d41d8a60ab2dbb982625a4..be4dee5d2650c9a54e81a170a7de8ca61897cfdc 100644 (file)
@@ -361,6 +361,14 @@ of a line.  The string is passed as the first argument to
   :type 'string
   :group 'rcirc)
 
+(defcustom rcirc-kill-channel-buffers nil
+  "When non-nil, kill channel buffers when the server buffer is killed.
+Only the channel buffers associated with the server in question
+will be killed."
+  :version "24.2"
+  :type 'boolean
+  :group 'rcirc)
+
 (defvar rcirc-nick nil)
 
 (defvar rcirc-prompt-start-marker nil)
@@ -1088,12 +1096,20 @@ Logfiles are kept in `rcirc-log-directory'."
   :group 'rcirc)
 
 (defun rcirc-kill-buffer-hook ()
-  "Part the channel when killing an rcirc buffer."
+  "Part the channel when killing an rcirc buffer.
+
+If `rcirc-kill-channel-buffers' is non-nil and the killed buffer
+is a server buffer, kills all of the channel buffers associated
+with it."
   (when (eq major-mode 'rcirc-mode)
     (when (and rcirc-log-flag
                rcirc-log-directory)
       (rcirc-log-write))
-    (rcirc-clean-up-buffer "Killed buffer")))
+    (rcirc-clean-up-buffer "Killed buffer")
+    (when (and rcirc-buffer-alist ;; it's a server buffer
+               rcirc-kill-channel-buffers)
+      (dolist (channel rcirc-buffer-alist)
+       (kill-buffer (cdr channel))))))
 
 (defun rcirc-change-major-mode-hook ()
   "Part the channel when changing the major-mode."