From 5b68cd1540599b4c39bbfdc42e6bc3dfaf01fcc8 Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 13 Oct 2003 20:28:26 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 27 +++++++++++++++++++++++++++ lisp/riece-button.el | 27 ++++++++++----------------- lisp/riece-display.el | 45 +++++++++++++++++++++++++++------------------ lisp/riece-globals.el | 4 ++-- lisp/riece.el | 14 ++++++++++---- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 55c7bd1..643f623 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,32 @@ 2003-10-13 Daiki Ueno + * 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 + * riece-history.el (riece-history-insinuate): In riece-after-switch-to-channel-functions, check whether the last channel is nil. diff --git a/lisp/riece-button.el b/lisp/riece-button.el index a9ac375..21b7039 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -43,10 +43,10 @@ (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) diff --git a/lisp/riece-display.el b/lisp/riece-display.el index f739af4..b3c2e6e 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -29,13 +29,16 @@ (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 @@ -101,6 +104,12 @@ (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 @@ -110,12 +119,6 @@ (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. @@ -162,11 +165,15 @@ "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) @@ -195,7 +202,9 @@ (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) diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index c3fc949..705a735 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -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 "-") diff --git a/lisp/riece.el b/lisp/riece.el index 40353b9..7ec6f4f 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -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)) -- 1.7.10.4