* riece.el (riece-channel-list-mode): Initialize
authorueno <ueno>
Mon, 13 Oct 2003 20:28:26 +0000 (20:28 +0000)
committerueno <ueno>
Mon, 13 Oct 2003 20:28:26 +0000 (20:28 +0000)
riece-update-buffer-functions.
(riece-user-list-mode): Ditto.

* riece-globals.el (riece-channel-indicator): Rename from
riece-short-channel-indicator.
(riece-long-channel-indicator): Rename from
riece-channel-indicator.

* riece-display.el (riece-update-buffer-functions): Default to
nil.
(riece-update-indicator-functions): New variable splitted from
riece-update-buffer-functions.
(riece-update-channel-indicator): Rename from
riece-update-short-channel-indicator.
(riece-update-long-channel-indicator): Rename from
riece-update-channel-indicator.
(riece-update-buffers): Don't set riece-channel-buffer.
(riece-switch-to-channel): Set riece-channel-buffer here.

* riece-button.el (riece-user-button-popup-menu): Change order.
(riece-button-update-buffer): Unify
riece-button-update-channel-list-buffer and
riece-button-update-user-list-buffer.

lisp/ChangeLog
lisp/riece-button.el
lisp/riece-display.el
lisp/riece-globals.el
lisp/riece.el

index 55c7bd1..643f623 100644 (file)
@@ -1,5 +1,32 @@
 2003-10-13  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece.el (riece-channel-list-mode): Initialize
+       riece-update-buffer-functions.
+       (riece-user-list-mode): Ditto.
+
+       * riece-globals.el (riece-channel-indicator): Rename from
+       riece-short-channel-indicator.
+       (riece-long-channel-indicator): Rename from
+       riece-channel-indicator.
+
+       * riece-display.el (riece-update-buffer-functions): Default to
+       nil.
+       (riece-update-indicator-functions): New variable splitted from
+       riece-update-buffer-functions.
+       (riece-update-channel-indicator): Rename from
+       riece-update-short-channel-indicator.
+       (riece-update-long-channel-indicator): Rename from
+       riece-update-channel-indicator.
+       (riece-update-buffers): Don't set riece-channel-buffer.
+       (riece-switch-to-channel): Set riece-channel-buffer here.
+
+       * riece-button.el (riece-user-button-popup-menu): Change order.
+       (riece-button-update-buffer): Unify
+       riece-button-update-channel-list-buffer and
+       riece-button-update-user-list-buffer.
+
+2003-10-13  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-history.el (riece-history-insinuate): In
        riece-after-switch-to-channel-functions, check whether the last
        channel is nil.
index a9ac375..21b7039 100644 (file)
 
 (defconst riece-user-button-popup-menu
   '("User"
+    ["Finger (WHOIS)" riece-user-button-finger]
     ["Start Private Conversation" riece-user-button-join-partner]
     ["Give Channel Operator Privileges" riece-user-button-set-operators]
-    ["Allow To Speak" riece-user-button-set-speakers]
-    ["Finger (WHOIS)" riece-user-button-finger])
+    ["Allow To Speak" riece-user-button-set-speakers])
   "Menu for user buttons.")
 
 (defvar help-echo-owns-message)
@@ -219,15 +219,8 @@ This function is used as a callback for a channel button."
                            (list 'local-map riece-identity-button-map
                                  'keymap riece-identity-button-map))))))
 
-(defun riece-button-update-channel-list-buffer ()
-  (save-excursion
-    (set-buffer riece-channel-list-buffer)
-    (riece-button-add-identity-button (point-min) (point-max))))
-
-(defun riece-button-update-user-list-buffer ()
-  (save-excursion
-    (set-buffer riece-user-list-buffer)
-    (riece-button-add-identity-button (point-min) (point-max))))
+(defun riece-button-update-buffer ()
+  (riece-button-add-identity-button (point-min) (point-max)))
 
 (defun riece-button-requires ()
   '(riece-highlight))
@@ -236,20 +229,20 @@ This function is used as a callback for a channel button."
 (defvar riece-user-list-mode-map)
 (defvar riece-dialogue-mode-map)
 (defun riece-button-insinuate ()
-  (add-hook 'riece-update-buffer-functions
-           'riece-button-update-channel-list-buffer t)
-  (add-hook 'riece-update-buffer-functions
-           'riece-button-update-user-list-buffer t)
   (add-hook 'riece-channel-list-mode-hook
            (lambda ()
              (set-keymap-parent riece-channel-list-mode-map widget-keymap)
              (set (make-local-variable 'riece-identity-button-map)
-                  (riece-make-identity-button-map))))
+                  (riece-make-identity-button-map))
+             (add-hook 'riece-update-buffer-functions
+                       'riece-button-update-buffer t t)))
   (add-hook 'riece-user-list-mode-hook
            (lambda ()
              (set-keymap-parent riece-user-list-mode-map widget-keymap)
              (set (make-local-variable 'riece-identity-button-map)
-                  (riece-make-identity-button-map))))
+                  (riece-make-identity-button-map))
+             (add-hook 'riece-update-buffer-functions
+                       'riece-button-update-buffer t t)))
   (add-hook 'riece-dialogue-mode-hook
            (lambda ()
              (set-keymap-parent riece-dialogue-mode-map widget-keymap)
index f739af4..b3c2e6e 100644 (file)
 (require 'riece-misc)
 (require 'riece-layout)
 
-(defvar riece-update-buffer-functions
-  '(riece-update-user-list-buffer
-    riece-update-channel-list-buffer
-    riece-update-status-indicators
+(defvar riece-update-buffer-functions nil
+  "Functions to redisplay the buffer.
+Local to the buffer in `riece-buffer-list'.")
+  
+(defvar riece-update-indicator-functions
+  '(riece-update-status-indicators
     riece-update-channel-indicator
-    riece-update-short-channel-indicator
-    riece-update-channel-list-indicator))
+    riece-update-long-channel-indicator
+    riece-update-channel-list-indicator)
+  "Functions to update modeline indicators.")
 
 (defun riece-update-user-list-buffer ()
   (save-excursion
 (defun riece-update-channel-indicator ()
   (setq riece-channel-indicator
        (if riece-current-channel
+           (riece-format-identity riece-current-channel)
+         "None")))
+
+(defun riece-update-long-channel-indicator ()
+  (setq riece-long-channel-indicator
+       (if riece-current-channel
            (if (riece-channel-p (riece-identity-prefix riece-current-channel))
                (riece-concat-channel-modes
                 riece-current-channel
              (riece-format-identity riece-current-channel))
          "None")))
 
-(defun riece-update-short-channel-indicator ()
-  (setq riece-short-channel-indicator
-       (if riece-current-channel
-           (riece-format-identity riece-current-channel)
-         "None")))
-
 (defun riece-update-channel-list-indicator ()
   (if (and riece-current-channels
           ;; There is at least one channel.
                "F"
              "-")))))
 
-(defun riece-update-buffers ()
-  (if riece-current-channel
-      (setq riece-channel-buffer (get-buffer (riece-channel-buffer-name
-                                             riece-current-channel))))
-  (run-hooks 'riece-update-buffer-functions)
+(defun riece-update-buffers (&optional buffers)
+  (unless buffers
+    (setq buffers riece-buffer-list))
+  (while buffers
+    (save-excursion
+      (set-buffer (car buffers))
+      (run-hooks 'riece-update-buffer-functions))
+    (setq buffers (cdr buffers)))
+  (run-hooks 'riece-update-indicator-functions)
   (force-mode-line-update t))
 
 (defun riece-channel-buffer-name (identity)
 
 (defun riece-switch-to-channel (identity)
   (let ((last riece-current-channel))
-    (setq riece-current-channel identity)
+    (setq riece-current-channel identity
+         riece-channel-buffer (get-buffer (riece-channel-buffer-name
+                                           riece-current-channel)))
     (run-hook-with-args 'riece-after-switch-to-channel-functions last)))
 
 (defun riece-join-channel (identity)
index c3fc949..705a735 100644 (file)
@@ -109,10 +109,10 @@ Local to the channel buffers.")
 ;;; Modeline indicators:
 (defvar riece-channel-indicator "None"
   "A modeline indicator of the current channel.")
+(defvar riece-long-channel-indicator "None"
+  "A modeline indicator of the current channel.")
 (defvar riece-channel-list-indicator "No channel"
   "A modeline indicator of the current joined channels.")
-(defvar riece-short-channel-indicator "None"
-  "A modeline indicator of the current channel.")
 (defvar riece-user-indicator nil)
 
 (defvar riece-away-indicator "-")
index 40353b9..7ec6f4f 100644 (file)
@@ -268,7 +268,7 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
        riece-current-channels nil
        riece-current-channel nil
        riece-user-indicator nil
-       riece-channel-indicator "None"
+       riece-long-channel-indicator "None"
        riece-channel-list-indicator "No channel"
        riece-away-indicator "-"
        riece-operator-indicator "-"
@@ -298,7 +298,7 @@ For a list of the generic commands type \\[riece-command-generic] ? RET.
           " "
           riece-user-indicator
           " "
-          riece-short-channel-indicator)))
+          riece-channel-indicator)))
   (riece-simplify-mode-line-format)
   (use-local-map riece-command-mode-map)
 
@@ -360,7 +360,7 @@ Instead, these commands are available:
           riece-operator-indicator
           riece-freeze-indicator
           " "
-          riece-channel-indicator))))
+          riece-long-channel-indicator))))
 
 (defun riece-channel-list-mode ()
   "Major mode for displaying channel list.
@@ -373,6 +373,9 @@ All normal editing commands are turned off."
        (riece-mode-line-buffer-identification '("Riece: "))
        truncate-lines t
        buffer-read-only t)
+  (make-local-hook 'riece-update-buffer-functions)
+  (add-hook 'riece-update-buffer-functions
+           'riece-update-channel-list-buffer nil t)
   (use-local-map riece-channel-list-mode-map)
   (run-hooks 'riece-channel-list-mode-hook))
 
@@ -387,11 +390,14 @@ Instead, these commands are available:
         mode-name "User list"
        mode-line-buffer-identification
        (riece-mode-line-buffer-identification
-        '("Riece: " riece-channel-indicator " "))
+        '("Riece: " riece-long-channel-indicator " "))
        truncate-lines t
        buffer-read-only t)
   (if (boundp 'transient-mark-mode)
       (set (make-local-variable 'transient-mark-mode) t))
+  (make-local-hook 'riece-update-buffer-functions)
+  (add-hook 'riece-update-buffer-functions
+           'riece-update-user-list-buffer nil t)
   (use-local-map riece-user-list-mode-map)
   (run-hooks 'riece-user-list-mode-hook))