From 1ab7dd4426c04d5afa6fba370c8f533e2ad4514e Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 16 Oct 2003 01:50:18 +0000 Subject: [PATCH] * riece.el (riece-buffer-alist): Rename from riece-buffer-mode-alist. * riece-misc.el (riece-get-buffer-create): Takes an optional 2nd argument, init-major-mode, which is used to assert the major-mode of the created buffer is 'riece-channel-mode. * riece-naming.el (riece-naming-assert-rename): Merged buffer renaming logic that riece-handle-nick-message was responsible for. * riece-globals.el (riece-server-process-alist): Revive. (riece-process-list): Abolish. (riece-command-buffer): Set default to nil. (riece-dialogue-buffer): Ditto. (riece-others-buffer): Ditto. (riece-channel-list-buffer): Ditto. (riece-user-list-buffer): Ditto. (riece-private-buffer): Abolish. (riece-wallops-buffer): Abolish. * riece-display.el (riece-channel-buffer-format): Moved from riece-globals. (riece-channel-buffer-alist): New variable. (riece-channel-buffer-create): Assert the major-mode of the created buffer is 'riece-channel-mode. (riece-channel-buffer): New function. (riece-switch-to-channel): Use riece-channel-buffer instead of directly using get-buffer. --- lisp/ChangeLog | 31 +++++++++++++++++++++++++++++++ lisp/riece-300.el | 12 ++++++------ lisp/riece-commands.el | 24 ++++++------------------ lisp/riece-ctcp.el | 20 ++++++++++---------- lisp/riece-display.el | 17 ++++++++++++++--- lisp/riece-filter.el | 2 +- lisp/riece-globals.el | 34 +++++++++++++++------------------- lisp/riece-handle.el | 38 +++++++++++++------------------------- lisp/riece-message.el | 2 +- lisp/riece-misc.el | 12 +++++++++--- lisp/riece-naming.el | 17 ++++++++++++++++- lisp/riece-ndcc.el | 4 ++-- lisp/riece-rdcc.el | 4 ++-- lisp/riece-server.el | 23 +++++++++++++---------- lisp/riece.el | 32 ++++++++++++++++---------------- 15 files changed, 155 insertions(+), 117 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b47ac68..e65da06 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,34 @@ +2003-10-16 Daiki Ueno + + * riece.el (riece-buffer-alist): Rename from + riece-buffer-mode-alist. + + * riece-misc.el (riece-get-buffer-create): Takes an optional 2nd + argument, init-major-mode, which is used to assert the major-mode + of the created buffer is 'riece-channel-mode. + + * riece-naming.el (riece-naming-assert-rename): Merged buffer + renaming logic that riece-handle-nick-message was responsible for. + + * riece-globals.el (riece-server-process-alist): Revive. + (riece-process-list): Abolish. + (riece-command-buffer): Set default to nil. + (riece-dialogue-buffer): Ditto. + (riece-others-buffer): Ditto. + (riece-channel-list-buffer): Ditto. + (riece-user-list-buffer): Ditto. + (riece-private-buffer): Abolish. + (riece-wallops-buffer): Abolish. + + * riece-display.el (riece-channel-buffer-format): Moved from + riece-globals. + (riece-channel-buffer-alist): New variable. + (riece-channel-buffer-create): Assert the major-mode of the + created buffer is 'riece-channel-mode. + (riece-channel-buffer): New function. + (riece-switch-to-channel): Use riece-channel-buffer instead of + directly using get-buffer. + 2003-10-14 Daiki Ueno * riece-commands.el (riece-command-toggle-away): Check user away diff --git a/lisp/riece-300.el b/lisp/riece-300.el index 3f9f0b5..4ec44e8 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -247,7 +247,7 @@ (riece-channel-set-topic (riece-get-channel channel) topic) (let* ((channel-identity (riece-make-identity channel riece-server-name)) - (buffer (riece-channel-buffer-name channel-identity))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-info buffer (concat visible " users, topic: " topic "\n")) (riece-insert-info @@ -273,7 +273,7 @@ (setq modes (cdr modes))) (let* ((channel-identity (riece-make-identity channel riece-server-name)) - (buffer (riece-channel-buffer-name channel-identity))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-info buffer (concat "Mode: " mode-string "\n")) (riece-insert-info (if (and riece-channel-buffer-mode @@ -294,7 +294,7 @@ (let* ((channel (match-string 1 string)) (message (substring string (match-end 0))) (channel-identity (riece-make-identity channel riece-server-name)) - (buffer (riece-channel-buffer-name channel-identity))) + (buffer (riece-channel-buffer channel-identity))) (if remove (riece-channel-set-topic (riece-get-channel channel) nil) (riece-channel-set-topic (riece-get-channel channel) message) @@ -323,7 +323,7 @@ (let* ((channel (match-string 1 string)) (user (substring string (match-end 0))) (channel-identity (riece-make-identity channel riece-server-name)) - (buffer (riece-channel-buffer-name channel-identity))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-info buffer (concat "Inviting " user "\n")) (riece-insert-info (if (and riece-channel-buffer-mode @@ -348,8 +348,8 @@ (flag (match-string 8 string)) (hops (match-string 9 string)) (name (substring string (match-end 0))) - (buffer (riece-channel-buffer-name - (riece-make-identity channel riece-server-name))) + (buffer (riece-channel-buffer (riece-make-identity + channel riece-server-name))) (info (format "%10s = %s (%s) [%s, %s, %s hops, on %s]" (concat (if (memq flag '(?@ ?+)) diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index fe04361..3439412 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -586,10 +586,10 @@ If prefix argument ARG is non-nil, toggle frozen status." (read-string "Message: ") (or riece-quit-message (riece-extended-version)))) - (process-list riece-process-list)) - (while process-list - (riece-quit-server-process (car process-list) message) - (setq process-list (cdr process-list)))))) + (alist riece-server-process-alist)) + (while alist + (riece-quit-server-process (cdr (car alist)) message) + (setq alist (cdr alist)))))) (defun riece-command-raw (command) "Enter raw IRC command, which is sent to the server." @@ -627,13 +627,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (defun riece-command-close-server (server-name &optional message) (interactive - (list (completing-read - "Server: " - (mapcar - (lambda (process) - (with-current-buffer (process-buffer process) - (list riece-server-name))) - riece-process-list)) + (list (completing-read "Server: " riece-server-process-alist) (if current-prefix-arg (read-string "Message: ") (or riece-quit-message @@ -643,13 +637,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (defun riece-command-universal-server-name-argument () (interactive) (let* ((riece-overriding-server-name - (completing-read - "Server: " - (mapcar - (lambda (process) - (with-current-buffer (process-buffer process) - (list riece-server-name))) - riece-process-list))) + (completing-read "Server: " riece-server-process-alist))) (command (key-binding (read-key-sequence (format "Command to execute on \"%s\":" diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 804b705..240c9ac 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -84,8 +84,8 @@ (defun riece-handle-ctcp-version-request (prefix target string) (let ((buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (riece-send-string (format "NOTICE %s :\1VERSION %s\1\r\n" user (riece-extended-version))) @@ -105,8 +105,8 @@ (defun riece-handle-ctcp-ping-request (prefix target string) (let ((buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (riece-send-string (if string @@ -128,8 +128,8 @@ (defun riece-handle-ctcp-clientinfo-request (prefix target string) (let ((buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (riece-send-string (format "NOTICE %s :\1CLIENTINFO %s\1\r\n" @@ -164,8 +164,8 @@ (defun riece-handle-ctcp-action-request (prefix target string) (let ((buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (riece-insert-change buffer (concat user " " string "\n")) (riece-insert-change @@ -289,8 +289,8 @@ (riece-send-string (format "PRIVMSG %s :\1ACTION %s\1\r\n" (riece-identity-prefix channel) action)) - (let ((buffer (riece-channel-buffer-name - (riece-make-identity channel riece-server-name)))) + (let ((buffer (riece-channel-buffer (riece-make-identity + channel riece-server-name)))) (riece-insert-change buffer (concat (riece-identity-prefix (riece-current-nickname)) " " action "\n")) diff --git a/lisp/riece-display.el b/lisp/riece-display.el index 33144dd..44a1254 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -29,6 +29,11 @@ (require 'riece-misc) (require 'riece-layout) +(defvar riece-channel-buffer-format "*Channel:%s*" + "Format of channel message buffer.") +(defvar riece-channel-buffer-alist nil + "An alist mapping identities to channel buffers.") + (defvar riece-update-buffer-functions nil "Functions to redisplay the buffer. Local to the buffer in `riece-buffer-list'.") @@ -187,7 +192,11 @@ Local to the buffer in `riece-buffer-list'.") (autoload 'riece-channel-mode "riece")) (defun riece-channel-buffer-create (identity) (with-current-buffer - (riece-get-buffer-create (riece-channel-buffer-name identity)) + (riece-get-buffer-create (riece-channel-buffer-name identity) + 'riece-channel-mode) + (setq riece-channel-buffer-alist + (cons (cons identity (current-buffer)) + riece-channel-buffer-alist)) (unless (eq major-mode 'riece-channel-mode) (riece-channel-mode) (let (buffer-read-only) @@ -199,11 +208,13 @@ Local to the buffer in `riece-buffer-list'.") (run-hook-with-args 'riece-channel-buffer-create-functions identity))) (current-buffer))) +(defun riece-channel-buffer (identity) + (cdr (riece-identity-assoc identity riece-channel-buffer-alist))) + (defun riece-switch-to-channel (identity) (let ((last riece-current-channel)) (setq riece-current-channel identity - riece-channel-buffer (get-buffer (riece-channel-buffer-name - riece-current-channel))) + riece-channel-buffer (riece-channel-buffer riece-current-channel)) (run-hook-with-args 'riece-after-switch-to-channel-functions last))) (defun riece-join-channel (identity) diff --git a/lisp/riece-filter.el b/lisp/riece-filter.el index 89abe6f..f522c48 100644 --- a/lisp/riece-filter.el +++ b/lisp/riece-filter.el @@ -158,7 +158,7 @@ (riece-redisplay-buffers) (riece-close-server-process process) ;; If no server process is available, exit. - (unless riece-process-list + (unless riece-server-process-alist (riece-exit))))) (provide 'riece-filter) diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index 705a735..ef5f3bc 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -30,9 +30,9 @@ (defconst riece-user-regexp "[][\\\\`_^{|}A-Za-z][][\\\\`_^{|}A-Za-z0-9-]\\{0,8\\}") -;;; Miscellaneous global variables: -(defvar riece-process-list nil - "List of processes opened in the current session.") +;;; Global variables: +(defvar riece-server-process-alist nil + "An alist mapping server names to processes.") (defvar riece-current-channel nil "The channel you currently have joined.") @@ -120,23 +120,19 @@ Local to the channel buffers.") (defvar riece-freeze-indicator "-") ;;; Buffers: -(defvar riece-command-buffer "*Commands*" - "Name of command input buffer.") -(defvar riece-dialogue-buffer "*Dialogue*" - "Name of dialogue output buffer.") -(defvar riece-private-buffer "*Private*" - "Name of private message buffer.") -(defvar riece-others-buffer "*Others*" - "Name of others message buffer.") +(defvar riece-command-buffer nil + "The command buffer.") +(defvar riece-dialogue-buffer nil + "Buffer for whole conversation.") +(defvar riece-others-buffer nil + "Buffer for other messages.") +(defvar riece-channel-list-buffer nil + "Buffer for channel list.") +(defvar riece-user-list-buffer nil + "Buffer for user list.") + (defvar riece-channel-buffer nil - "Name of channel message buffer.") -(defvar riece-channel-buffer-format "*Channel:%s*" - "Format of channel message buffer.") -(defvar riece-channel-list-buffer "*Channels*" - "Name of channel list buffer.") -(defvar riece-user-list-buffer " *Users*" - "Name of user list buffer.") -(defvar riece-wallops-buffer " *WALLOPS*") + "Buffer for messages arrived in the current channel.") (defvar riece-buffer-list nil) (defvar riece-overriding-server-name nil) diff --git a/lisp/riece-handle.el b/lisp/riece-handle.el index e35515e..6d36577 100644 --- a/lisp/riece-handle.el +++ b/lisp/riece-handle.el @@ -42,19 +42,12 @@ (riece-make-identity channel riece-server-name)) channels)))) (riece-naming-assert-rename old new) - (let ((pointer (riece-identity-member old-identity - riece-current-channels))) - (when pointer - (setcar pointer new-identity) - (with-current-buffer (riece-channel-buffer-name new-identity) - (rename-buffer (riece-channel-buffer-name new-identity))) - (if (riece-identity-equal new-identity riece-current-channel) - (riece-switch-to-channel new-identity)) - (setq channels (cons new-identity channels)))) + (if (riece-identity-member old-identity riece-current-channels) + (setq channels (cons new channels))) (riece-insert-change (mapcar (lambda (channel) - (riece-channel-buffer-name - (riece-make-identity channel riece-server-name))) + (riece-channel-buffer (riece-make-identity + channel riece-server-name))) channels) (format "%s -> %s\n" (riece-format-identity old-identity t) @@ -116,8 +109,7 @@ (riece-naming-assert-join user (car channels)) (let* ((channel-identity (riece-make-identity (car channels) riece-server-name)) - (buffer (get-buffer (riece-channel-buffer-name - channel-identity)))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer (format "%s (%s) has joined %s\n" @@ -151,8 +143,7 @@ (riece-naming-assert-part user (car channels)) (let* ((channel-identity (riece-make-identity (car channels) riece-server-name)) - (buffer (get-buffer (riece-channel-buffer-name - channel-identity)))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer (concat @@ -188,7 +179,7 @@ (channel-identity (riece-make-identity channel riece-server-name)) (user-identity (riece-make-identity user riece-server-name))) (riece-naming-assert-part user channel) - (let ((buffer (get-buffer (riece-channel-buffer-name channel-identity)))) + (let ((buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer (concat @@ -232,9 +223,8 @@ (let ((buffers (mapcar (lambda (channel) - (get-buffer - (riece-channel-buffer-name - (riece-make-identity channel riece-server-name)))) + (riece-channel-buffer (riece-make-identity channel + riece-server-name))) channels))) (riece-insert-change buffers @@ -277,9 +267,8 @@ (let ((buffers (mapcar (lambda (channel) - (get-buffer - (riece-channel-buffer-name - (riece-make-identity channel riece-server-name)))) + (riece-channel-buffer (riece-make-identity channel + riece-server-name))) channels))) (riece-insert-change buffers @@ -333,7 +322,7 @@ (user-identity (riece-make-identity user riece-server-name)) (channel-identity (riece-make-identity channel riece-server-name))) (riece-channel-set-topic (riece-get-channel channel) topic) - (let ((buffer (get-buffer (riece-channel-buffer-name channel-identity)))) + (let ((buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer (format "Topic by %s: %s\n" @@ -392,8 +381,7 @@ string (substring string (match-end 0))) (riece-parse-channel-modes string channel) (let* ((channel-identity (riece-make-identity channel riece-server-name)) - (buffer (get-buffer (riece-channel-buffer-name - channel-identity)))) + (buffer (riece-channel-buffer channel-identity))) (riece-insert-change buffer (format "Mode by %s: %s\n" diff --git a/lisp/riece-message.el b/lisp/riece-message.el index bac5784..60702eb 100644 --- a/lisp/riece-message.el +++ b/lisp/riece-message.el @@ -119,7 +119,7 @@ (unless riece-current-channel (riece-switch-to-channel target)) (riece-redisplay-buffers)) - (riece-channel-buffer-name target))) + (riece-channel-buffer target))) (defun riece-message-parent-buffers (message buffer) "Return the parents of BUFFER where MESSAGE should appear. diff --git a/lisp/riece-misc.el b/lisp/riece-misc.el index d3a21d4..c4fa7bc 100644 --- a/lisp/riece-misc.el +++ b/lisp/riece-misc.el @@ -32,8 +32,14 @@ (require 'riece-server) (require 'riece-user) -(defun riece-get-buffer-create (name) - (let ((buffer (get-buffer-create name))) +(defun riece-get-buffer-create (name &optional init-major-mode) + (let ((buffer (get-buffer name))) + (unless (and buffer + (or (null init-major-mode) + (eq (with-current-buffer buffer + major-mode) + init-major-mode))) + (setq buffer (generate-new-buffer name))) (unless (memq buffer riece-buffer-list) (setq riece-buffer-list (cons buffer riece-buffer-list))) buffer)) @@ -59,7 +65,7 @@ (while buffers (run-hooks 'riece-before-insert-functions) (save-excursion - (set-buffer (riece-get-buffer-create (car buffers))) + (set-buffer (car buffers)) (let ((inhibit-read-only t) buffer-read-only (start (goto-char (point-max)))) diff --git a/lisp/riece-naming.el b/lisp/riece-naming.el index ca9d8a0..4c1a91f 100644 --- a/lisp/riece-naming.el +++ b/lisp/riece-naming.el @@ -69,7 +69,22 @@ (if pointer (setcar pointer new-name)) (setq channels (cdr channels))) - (riece-rename-user old-name new-name))) + (riece-rename-user old-name new-name)) + ;; Rename the channel buffer. + (let* ((old-identity (riece-make-identity old-name riece-server-name)) + (new-identity (riece-make-identity new-name riece-server-name)) + (pointer (riece-identity-member old-identity riece-current-channels))) + (when pointer + (setcar pointer new-identity) + (with-current-buffer (riece-channel-buffer old-identity) + (rename-buffer (riece-channel-buffer-name new-identity) t) + (setq riece-channel-buffer-alist + (cons (cons new-identity (current-buffer)) + (delq (riece-identity-assoc old-identity + riece-channel-buffer-alist) + riece-channel-buffer-alist)))) + (if (riece-identity-equal old-identity riece-current-channel) + (riece-switch-to-channel new-identity))))) (provide 'riece-naming) diff --git a/lisp/riece-ndcc.el b/lisp/riece-ndcc.el index a5a9ae8..dd0553a 100644 --- a/lisp/riece-ndcc.el +++ b/lisp/riece-ndcc.el @@ -195,8 +195,8 @@ Only used for sending files." (port (string-to-number (match-string 3 message))) (size (string-to-number (match-string 4 message))) (buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (setq riece-ndcc-requests (cons (list user file address port size) diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 46429ce..9328098 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -271,8 +271,8 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" (port (string-to-number (match-string 3 message))) (size (string-to-number (match-string 4 message))) (buffer (if (riece-channel-p target) - (riece-channel-buffer-name - (riece-make-identity target riece-server-name)))) + (riece-channel-buffer (riece-make-identity + target riece-server-name)))) (user (riece-prefix-nickname prefix))) (setq riece-rdcc-requests (cons (list user file address port size) diff --git a/lisp/riece-server.el b/lisp/riece-server.el index 2b18ba1..7a918ff 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -93,7 +93,7 @@ the `riece-server-keyword-map' variable." (format "IRC<%s>" server-name))) (defun riece-server-process (server-name) - (get-process (riece-server-process-name server-name))) + (cdr (assoc server-name riece-server-process-alist))) (defmacro riece-with-server-buffer (server-name &rest body) `(let ((process (riece-server-process ,server-name))) @@ -165,8 +165,9 @@ the `riece-server-keyword-map' variable." (setq riece-last-nickname riece-real-nickname riece-nick-accepted 'sent riece-coding-system coding)) - (setq riece-process-list - (cons process riece-process-list))))) + (setq riece-server-process-alist + (cons (cons server-name process) + riece-server-process-alist))))) (defun riece-reset-process-buffer (process) (save-excursion @@ -197,25 +198,27 @@ the `riece-server-keyword-map' variable." (if riece-debug (delete-process process) (kill-buffer (process-buffer process))) - (setq riece-process-list (delq process riece-process-list))) + (setq riece-server-process-alist + (delq (rassq process riece-server-process-alist) + riece-server-process-alist))) (defun riece-server-opened (&optional server-name) - (let ((process-list riece-process-list)) + (let ((alist riece-server-process-alist)) (catch 'found - (while process-list - (if (memq (process-status (car process-list)) '(open run)) + (while alist + (if (memq (process-status (cdr (car alist))) '(open run)) (throw 'found t)) - (setq process-list (cdr process-list)))))) + (setq alist (cdr alist)))))) (eval-when-compile (autoload 'riece-exit "riece")) (defun riece-quit-server-process (process &optional message) (run-at-time riece-quit-timeout nil (lambda (process) - (when (memq process riece-process-list) + (when (rassq process riece-server-process-alist) (riece-close-server-process process) ;; If no server process is available, exit. - (unless riece-process-list + (unless riece-server-process-alist (riece-exit)))) process) (riece-process-send-string process diff --git a/lisp/riece.el b/lisp/riece.el index 3cf1ef3..2f3b858 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -45,20 +45,18 @@ (put 'riece-command-mode 'mode-class 'special) (put 'riece-dialogue-mode 'mode-class 'special) +(put 'riece-others-mode 'derived-mode-parent 'riece-dialogue-mode) (put 'riece-channel-list-mode 'mode-class 'special) (put 'riece-user-list-mode 'mode-class 'special) (put 'riece-channel-mode 'derived-mode-parent 'riece-dialogue-mode) -(put 'riece-others-mode 'derived-mode-parent 'riece-dialogue-mode) -(defvar riece-buffer-mode-alist - '((riece-command-buffer . riece-command-mode) - (riece-dialogue-buffer . riece-dialogue-mode) - (riece-others-buffer . riece-others-mode) - (riece-user-list-buffer . riece-user-list-mode) - (riece-channel-list-buffer . riece-channel-list-mode) - (riece-private-buffer . riece-dialogue-mode) - (riece-wallops-buffer))) - +(defvar riece-buffer-alist + '((riece-command-buffer "*Commands*" riece-command-mode) + (riece-dialogue-buffer "*Dialogue*" riece-dialogue-mode) + (riece-others-buffer "*Others*" riece-others-mode) + (riece-channel-list-buffer "*Channels*" riece-channel-list-mode) + (riece-user-list-buffer " *Users*" riece-user-list-mode))) + (defvar riece-select-keys '("1" riece-command-switch-to-channel-by-number-1 "2" riece-command-switch-to-channel-by-number-2 @@ -267,6 +265,7 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect." (setq riece-server nil riece-current-channels nil riece-current-channel nil + riece-channel-buffer-alist nil riece-user-indicator nil riece-long-channel-indicator "None" riece-channel-list-indicator "No channel" @@ -402,14 +401,15 @@ Instead, these commands are available: (run-hooks 'riece-user-list-mode-hook)) (defun riece-create-buffers () - (let ((alist riece-buffer-mode-alist)) + (let ((alist riece-buffer-alist)) (while alist (save-excursion - (set-buffer (riece-get-buffer-create - (symbol-value (car (car alist))))) - (unless (or (null (cdr (car alist))) - (eq major-mode (cdr (car alist)))) - (funcall (cdr (car alist)))) + (set-buffer (apply #'riece-get-buffer-create + (cdr (car alist)))) + (set (car (car alist)) (current-buffer)) + (unless (or (null (nth 2 (car alist))) + (eq major-mode (nth 2 (car alist)))) + (funcall (nth 2 (car alist)))) (setq alist (cdr alist)))))) (defun riece-load-and-build-addon-dependencies (addons) -- 1.7.10.4