From 5e7ed98f7c6497b67376977fafdf2dd860537f14 Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Tue, 21 Apr 2015 08:54:04 -0400 Subject: [PATCH] bury RCIRC buffers when there is no activity lisp/net/rcirc.el (rcirc-non-irc-buffer): remove (rcirc-bury-buffers): new function (rcirc-next-active-buffer): when there is no new activity, use `rcirc-bury-buffers' to hide all RCIRC buffers --- lisp/net/rcirc.el | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 5ea10475cea..11db7a2cab2 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1924,17 +1924,13 @@ Uninteresting lines are those whose responses are listed in (goto-char overlay-arrow-position) (message "No unread messages"))) -(defun rcirc-non-irc-buffer () - (let ((buflist (buffer-list)) - buffer) - (while (and buflist (not buffer)) - (with-current-buffer (car buflist) - (unless (or (eq major-mode 'rcirc-mode) - (= ?\s (aref (buffer-name) 0)) ; internal buffers - (get-buffer-window (current-buffer))) - (setq buffer (current-buffer)))) - (setq buflist (cdr buflist))) - buffer)) +(defun rcirc-bury-buffers () + "Bury all RCIRC buffers." + (interactive) + (dolist (buf (buffer-list)) + (when (eq 'rcirc-mode (with-current-buffer buf major-mode)) + (bury-buffer buf) ; buffers not shown + (quit-windows-on buf)))) ; buffers shown in a window (defun rcirc-next-active-buffer (arg) "Switch to the next rcirc buffer with activity. @@ -1949,15 +1945,13 @@ With prefix ARG, go to the next low priority buffer with activity." (switch-to-buffer (car (if arg lopri hipri))) (when (> (point) rcirc-prompt-start-marker) (recenter -1))) - (if (eq major-mode 'rcirc-mode) - (switch-to-buffer (rcirc-non-irc-buffer)) - (message "%s" (concat - "No IRC activity." - (when lopri - (concat - " Type C-u " - (key-description (this-command-keys)) - " for low priority activity.")))))))) + (rcirc-bury-buffers) + (message "No IRC activity.%s" + (if lopri + (concat + " Type C-u " (key-description (this-command-keys)) + " for low priority activity.") + ""))))) (define-obsolete-variable-alias 'rcirc-activity-hooks 'rcirc-activity-functions "24.3") -- 2.39.2