* riece-options.el (riece-channel-history-length): New user option.
authorDaiki Ueno <ueno@unixuser.org>
Wed, 27 Aug 2003 00:46:50 +0000 (00:46 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Wed, 27 Aug 2003 00:46:50 +0000 (00:46 +0000)
(riece-connection-timeout): Abolish.

* riece-globals.el (riece-channel-history): New variable.
(riece-last-channel): Abolish.

* riece-display.el: Autoload ring-insert.
(riece-switch-to-channel): Update riece-channel-history.
(riece-switch-to-nearest-channel): Ditto.

* riece-server.el (riece-clear-system): Abolish.
* riece.el (riece-exit): Merge riece-clear-system.
(riece): Initialize riece-channel-history.

lisp/ChangeLog
lisp/riece-display.el
lisp/riece-globals.el
lisp/riece-options.el
lisp/riece-server.el
lisp/riece.el

index dd30d8d..c526057 100644 (file)
@@ -1,3 +1,19 @@
+2003-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-options.el (riece-channel-history-length): New user option.
+       (riece-connection-timeout): Abolish.
+
+       * riece-globals.el (riece-channel-history): New variable.
+       (riece-last-channel): Abolish.
+
+       * riece-display.el: Autoload ring-insert.
+       (riece-switch-to-channel): Update riece-channel-history.
+       (riece-switch-to-nearest-channel): Ditto.
+
+       * riece-server.el (riece-clear-system): Abolish.
+       * riece.el (riece-exit): Merge riece-clear-system.
+       (riece): Initialize riece-channel-history.
+
 2003-08-26  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-filter.el (riece-sentinel): Suppress status message when
index e72fe27..bb49009 100644 (file)
@@ -29,6 +29,8 @@
 (require 'riece-misc)
 (require 'riece-layout)
 
+(autoload 'ring-insert "ring")
+
 (defvar riece-update-buffer-functions
   '(riece-update-user-list-buffer
     riece-update-channel-list-buffer
     (current-buffer)))
 
 (defun riece-switch-to-channel (identity)
-  (setq riece-last-channel riece-current-channel
-       riece-current-channel identity)
+  (ring-insert riece-channel-history riece-current-channel)
+  (setq riece-current-channel identity)
   (run-hooks 'riece-channel-switch-hook))
 
 (defun riece-join-channel (identity)
       (setq identity (car pointer)))
     (if identity
        (riece-switch-to-channel identity)
-      (setq riece-last-channel riece-current-channel
-           riece-current-channel nil))))
+      (ring-insert riece-channel-history riece-current-channel)
+      (setq riece-current-channel nil))))
 
 (defun riece-part-channel (identity)
   (let ((pointer (riece-identity-member identity riece-current-channels)))
index 7488e7b..97f13e4 100644 (file)
@@ -38,8 +38,8 @@
   "The channel you currently have joined.")
 (defvar riece-current-channels nil
   "The channels you have currently joined.")
-(defvar riece-last-channel nil
-  "The channel you had joined the last time.")
+(defvar riece-channel-history nil
+  "List of channels user has visited.")
 
 (defvar riece-save-variables-are-dirty nil
   "Non nil if the variables in `riece-saved-forms' are changed.")
index 897c876..ba3ca54 100644 (file)
@@ -233,11 +233,6 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'boolean
   :group 'riece-options)
 
-(defcustom riece-connection-timeout 60
-  "Default timeout interval."
-  :type 'integer
-  :group 'riece-server)
-  
 (defcustom riece-buffer-dispose-function #'bury-buffer
   "Function called after the buffer was disposed."
   :type 'function
@@ -248,6 +243,11 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'function
   :group 'riece-options)
 
+(defcustom riece-channel-history-length 3
+  "Length of riece-channel-history."
+  :type 'integer
+  :group 'riece-options)
+
 (provide 'riece-options)
 
 ;;; riece-options.el ends here
index 756598b..25d67a4 100644 (file)
@@ -62,22 +62,6 @@ the `riece-server-keyword-map' variable."
 (put 'riece-server-keyword-bind 'lisp-indent-function 1)
 (put 'riece-server-keyword-bind 'edebug-form-spec '(form body))
 
-(defun riece-clear-system ()
-  (while riece-buffer-list
-    (if (and (get-buffer (car riece-buffer-list))
-            (buffer-live-p (car riece-buffer-list)))
-       (funcall riece-buffer-dispose-function (car riece-buffer-list)))
-    (setq riece-buffer-list (cdr riece-buffer-list)))
-  (setq riece-current-channels nil
-       riece-current-channel nil
-       riece-user-indicator nil
-       riece-channel-indicator "None"
-       riece-channel-list-indicator "No channel"
-       riece-away-indicator "-"
-       riece-operator-indicator "-"
-       riece-freeze-indicator "-")
-  (delete-other-windows))
-
 (defun riece-server-parse-string (string)
   "Convert a STRING set as `riece-server' and return a property list."
   (when (or (string-match "^\\[\\([^]]+\\)\\]:?\\([0-9]*\\)" string)
index 4de3a8b..2c95c7c 100644 (file)
@@ -30,6 +30,8 @@
 (require 'riece-compat)
 (require 'riece-commands)
 
+(autoload 'make-ring "ring")
+
 (defvar riece-channel-list-mode-map (make-sparse-keymap))
 (defvar riece-user-list-mode-map (make-sparse-keymap))
 
@@ -255,13 +257,28 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
   (riece-redisplay-buffers)
   (riece-open-server riece-server "")
   (run-hooks 'riece-startup-hook)
+  (setq riece-channel-history (make-ring riece-channel-history-length))
   (message "%s" (substitute-command-keys "Type \\[describe-mode] for help")))
 
 (defun riece-exit ()
-  (setq riece-server nil)
   (if riece-save-variables-are-dirty
       (riece-save-variables-files))
-  (riece-clear-system)
+  (while riece-buffer-list
+    (if (and (get-buffer (car riece-buffer-list))
+            (buffer-live-p (car riece-buffer-list)))
+       (funcall riece-buffer-dispose-function (car riece-buffer-list)))
+    (setq riece-buffer-list (cdr riece-buffer-list)))
+  (setq riece-server nil
+       riece-current-channels nil
+       riece-current-channel nil
+       riece-user-indicator nil
+       riece-channel-indicator "None"
+       riece-channel-list-indicator "No channel"
+       riece-away-indicator "-"
+       riece-operator-indicator "-"
+       riece-freeze-indicator "-"
+       riece-channel-history nil)
+  (delete-other-windows)
   (run-hooks 'riece-exit-hook))
 
 (defun riece-command-mode ()