* riece-display.el (riece-configure-windows-predicate): New function.
[riece] / lisp / riece-display.el
index be5934c..b99f12b 100644 (file)
   :type 'function
   :group 'riece-looks)
 
+(defcustom riece-configure-windows-predicate
+  #'riece-configure-windows-predicate
+  "Function to check whether window reconfiguration is needed."
+  :type 'function
+  :group 'riece-looks)
+
 (defun riece-configure-windows ()
   (let ((buffer (current-buffer))
        (show-user-list
     (if (riece-identity-equal-no-server identity riece-current-channel)
        (riece-switch-to-nearest-channel pointer))))
 
+(defun riece-configure-windows-predicate ()
+  ;; The current channel is changed, and some buffers are visible.
+  (unless (equal riece-last-channel riece-current-channel)
+    (let ((buffers riece-buffer-list))
+      (catch 'found
+       (while buffers
+         (if (and (buffer-live-p (car buffers))
+                  (get-buffer-window (car buffers)))
+             (throw 'found t)
+           (setq buffers (cdr buffers))))))))
+
 (defun riece-redisplay-buffers (&optional force)
   (riece-update-buffers)
   (if (or force
-         ;; The current channel is changed, and some buffers are visible.
-         (unless (equal riece-last-channel riece-current-channel)
-           (let ((buffers riece-buffer-list))
-             (catch 'found
-               (while buffers
-                 (if (and (buffer-live-p (car buffers))
-                          (get-buffer-window (car buffers)))
-                     (throw 'found t)
-                   (setq buffers (cdr buffers))))))))
+         (funcall riece-configure-windows-predicate))
       (funcall riece-configure-windows-function)))
 
 (provide 'riece-display)