* riece-unread.el (riece-unread-after-display-message-function):
authorueno <ueno>
Wed, 27 Aug 2003 07:37:46 +0000 (07:37 +0000)
committerueno <ueno>
Wed, 27 Aug 2003 07:37:46 +0000 (07:37 +0000)
Rename from riece-unread-display-message-function.
(riece-unread-after-switch-to-channel-function): Rename from
riece-unread-channel-switch-hook.
(riece-guess-channel-from-unread): New function.
(riece-unread-requires): Require 'riece-guess and 'riece-history.
(riece-unread-insinuate): Setup riece-guess-channel-try-functions.

* riece-options.el (riece-addons): Add riece-guess, riece-history,
and riece-url.

* riece-layout.el (riece-reconfigure-windows-predicate): Don't
check riece-last-channel.

* riece-display.el (riece-switch-to-channel): Rename
riece-channel-switch-hook to
riece-after-switch-to-channel-functions.
(riece-switch-to-nearest-channel): Ditto.

* riece-guess.el: New add-on.
* COMPILE (riece-modules): Add riece-guess.
* Makefile.am (EXTRA_DIST): Add riece-guess.el

* riece-history.el: New add-on.
* COMPILE (riece-modules): Add riece-history.
* Makefile.am (EXTRA_DIST): Add riece-history.el

lisp/COMPILE
lisp/ChangeLog
lisp/Makefile.am
lisp/riece-display.el
lisp/riece-globals.el
lisp/riece-highlight.el
lisp/riece-layout.el
lisp/riece-options.el
lisp/riece-unread.el
lisp/riece.el

index 88ade99..5c796d0 100644 (file)
@@ -50,7 +50,9 @@
                riece-unread
                riece-doctor
                riece-alias
-               riece-skk-kakutei))))
+               riece-skk-kakutei
+               riece-guess
+               riece-history))))
 
 (defun riece-compile-modules (modules)
   (let ((load-path (cons nil load-path)))
index 224e06a..e186cf0 100644 (file)
@@ -1,5 +1,34 @@
 2003-08-27  Daiki Ueno  <ueno@unixuser.org>
 
+       * riece-unread.el (riece-unread-after-display-message-function):
+       Rename from riece-unread-display-message-function.
+       (riece-unread-after-switch-to-channel-function): Rename from
+       riece-unread-channel-switch-hook.
+       (riece-guess-channel-from-unread): New function.
+       (riece-unread-requires): Require 'riece-guess and 'riece-history.
+       (riece-unread-insinuate): Setup riece-guess-channel-try-functions.
+
+       * riece-options.el (riece-addons): Add riece-guess, riece-history,
+       and riece-url.
+
+       * riece-layout.el (riece-reconfigure-windows-predicate): Don't
+       check riece-last-channel.
+
+       * riece-display.el (riece-switch-to-channel): Rename
+       riece-channel-switch-hook to
+       riece-after-switch-to-channel-functions.
+       (riece-switch-to-nearest-channel): Ditto.
+
+       * riece-guess.el: New add-on.
+       * COMPILE (riece-modules): Add riece-guess.
+       * Makefile.am (EXTRA_DIST): Add riece-guess.el
+
+       * riece-history.el: New add-on.
+       * COMPILE (riece-modules): Add riece-history.
+       * Makefile.am (EXTRA_DIST): Add riece-history.el
+
+2003-08-27  Daiki Ueno  <ueno@unixuser.org>
+
        * riece-options.el (riece-connection-timeout): Abolish.
 
        * riece-server.el (riece-clear-system): Abolish.
index 745e3cc..3a29c10 100644 (file)
@@ -8,7 +8,8 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \
        riece-xemacs.el riece.el \
        riece-ctcp.el riece-url.el riece-unread.el \
        riece-ndcc.el riece-rdcc.el riece-log.el riece-mini.el \
-       riece-doctor.el riece-alias.el riece-layout.el riece-skk-kakutei.el
+       riece-doctor.el riece-alias.el riece-layout.el riece-skk-kakutei.el \
+       riece-guess.el riece-history.el
 
 CLEANFILES = auto-autoloads.el custom-load.el *.elc
 FLAGS ?= -batch -q -no-site-file
index e72fe27..8ddf882 100644 (file)
     (current-buffer)))
 
 (defun riece-switch-to-channel (identity)
-  (setq riece-last-channel riece-current-channel
-       riece-current-channel identity)
-  (run-hooks 'riece-channel-switch-hook))
+  (let ((last riece-current-channel))
+    (setq riece-current-channel identity)
+    (run-hook-with-args 'riece-after-switch-to-channel-functions last)))
 
 (defun riece-join-channel (identity)
   (unless (riece-identity-member identity riece-current-channels)
       (setq identity (car pointer)))
     (if identity
        (riece-switch-to-channel identity)
-      (setq riece-last-channel riece-current-channel
-           riece-current-channel nil))))
+      (let ((last riece-current-channel))
+       (run-hook-with-args 'riece-after-switch-to-channel-functions last)
+       (setq riece-current-channel nil)))))
 
 (defun riece-part-channel (identity)
   (let ((pointer (riece-identity-member identity riece-current-channels)))
index 97f13e4..51b58c3 100644 (file)
@@ -38,8 +38,6 @@
   "The channel you currently have joined.")
 (defvar riece-current-channels nil
   "The channels you have currently joined.")
-(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 f6a50f3..6aa09fa 100644 (file)
     (if (looking-at riece-prefix-regexp)
        (put-text-property (match-beginning 1) (match-end 1) 'invisible t))))
 
-(defun riece-channel-list-mark-current-channel ()
+(defun riece-channel-list-mark-current-channel (last)
   (if (and riece-channel-list-buffer-mode
           riece-current-channel)
       (save-excursion
            'riece-dialogue-schedule-turn-on-font-lock)
   (put 'riece-channel-list-mode 'font-lock-defaults
        '(riece-channel-list-font-lock-keywords t))
-  (add-hook 'riece-channel-switch-hook
+  (add-hook 'riece-after-switch-to-channel-functions
            'riece-channel-list-mark-current-channel)
   (add-hook 'riece-after-load-startup-hook
            'riece-channel-list-schedule-turn-on-font-lock))
index 0d6ffbd..469235b 100644 (file)
@@ -128,15 +128,14 @@ This function is used by \"default\" layout."
 (defun riece-reconfigure-windows-predicate ()
   "Return t, if window reconfiguration is needed.
 This function is used by \"default\" layout."
-  ;; 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))))))))
+  ;; Check whether there is a buffer which belongs to Riece is visible.
+  (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-configure-windows-top (&optional plist)
   "Candidate of `riece-configure-windows-function'.
index da67656..d40dedd 100644 (file)
@@ -100,7 +100,12 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type '(repeat (file :tag "Initialization File"))
   :group 'riece-options)
 
-(defcustom riece-addons '(riece-highlight riece-ctcp riece-unread)
+(defcustom riece-addons '(riece-highlight
+                         riece-ctcp
+                         riece-guess
+                         riece-unread
+                         riece-history
+                         riece-url)
   "Add-ons insinuated into Riece."
   :type '(repeat symbol)
   :group 'riece-options)
index 5ba652f..eb4a16e 100644 (file)
@@ -61,7 +61,7 @@
 
 (defvar riece-unread-channels nil)
 
-(defun riece-unread-display-message-function (message)
+(defun riece-unread-after-display-message-function (message)
   (unless (or (riece-message-own-p message)
              (equal (riece-message-target message) riece-current-channel))
     (setq riece-unread-channels
@@ -70,7 +70,7 @@
                 (riece-message-target message))
     (riece-unread-update-channel-list-buffer)))
 
-(defun riece-unread-channel-switch-hook ()
+(defun riece-unread-after-switch-to-channel-function (last)
   (setq riece-unread-channels
        (delete riece-current-channel
                riece-unread-channels))
       (riece-command-switch-to-channel (car riece-unread-channels))
     (error "No unread channel!")))
 
+(defun riece-guess-channel-from-unread ()
+  riece-unread-channels)
+
 (defvar riece-command-mode-map)
 (defvar riece-dialogue-mode-map)
 (defvar riece-channel-list-mode-map)
 
 (defun riece-unread-requires ()
-  (if (memq 'riece-highlight riece-addons)
-      '(riece-highlight)))
+  (let (requires)
+    (if (memq 'riece-highlight riece-addons)
+       (setq requires (cons 'riece-highlight requires)))
+    (if (memq 'riece-guess riece-addons)
+       (setq requires (cons 'riece-guess requires)))
+    ;; riece-guess-channel-from-unread should be prior to
+    ;; riece-guess-channel-from-history.
+    (if (memq 'riece-history riece-addons)
+       (setq requires (cons 'riece-history requires)))
+    requires))
 
 (defun riece-unread-insinuate ()
   (add-hook 'riece-after-display-message-functions
-           'riece-unread-display-message-function)
-  (add-hook 'riece-channel-switch-hook
-           'riece-unread-channel-switch-hook)
+           'riece-unread-after-display-message-function)
+  (add-hook 'riece-after-switch-to-channel-functions
+           'riece-unread-after-switch-to-channel-function)
   (add-hook 'riece-update-buffer-functions
            'riece-unread-update-channel-list-buffer t)
   (define-key riece-command-mode-map
   (if (memq 'riece-highlight riece-addons)
       (setq riece-channel-list-mark-face-alist
            (cons '(?! . riece-channel-list-unread-face)
-                 riece-channel-list-mark-face-alist))))
+                 riece-channel-list-mark-face-alist)))
+  (if (memq 'riece-guess riece-addons)
+      (add-hook 'riece-guess-channel-try-functions
+               'riece-guess-channel-from-unread)))
 
 (provide 'riece-unread)
 
index 1dc512a..4401c66 100644 (file)
@@ -273,8 +273,7 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
        riece-channel-list-indicator "No channel"
        riece-away-indicator "-"
        riece-operator-indicator "-"
-       riece-freeze-indicator "-"
-       riece-channel-history nil)
+       riece-freeze-indicator "-")
   (delete-other-windows)
   (run-hooks 'riece-exit-hook))