From: Daiki Ueno Date: Wed, 27 Aug 2003 07:37:46 +0000 (+0000) Subject: * riece-unread.el (riece-unread-after-display-message-function): X-Git-Url: http://cgit.sxemacs.org/?p=riece;a=commitdiff_plain;h=d44bc59776f059686a3588f8a99be255d606c9e4 * 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 --- diff --git a/lisp/COMPILE b/lisp/COMPILE index 88ade99..5c796d0 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -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))) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 224e06a..e186cf0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,32 @@ +2003-08-27 Daiki Ueno + + * 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 * riece-options.el (riece-connection-timeout): Abolish. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 745e3cc..3a29c10 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -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 diff --git a/lisp/riece-display.el b/lisp/riece-display.el index e72fe27..8ddf882 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -180,9 +180,9 @@ (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) @@ -211,8 +211,9 @@ (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))) diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index 97f13e4..51b58c3 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -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.") diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index f6a50f3..6aa09fa 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -255,7 +255,7 @@ (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 @@ -296,7 +296,7 @@ '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)) diff --git a/lisp/riece-layout.el b/lisp/riece-layout.el index 0d6ffbd..469235b 100644 --- a/lisp/riece-layout.el +++ b/lisp/riece-layout.el @@ -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'. diff --git a/lisp/riece-options.el b/lisp/riece-options.el index da67656..d40dedd 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -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) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index 5ba652f..eb4a16e 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -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)) @@ -101,19 +101,30 @@ (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 @@ -125,7 +136,10 @@ (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) diff --git a/lisp/riece.el b/lisp/riece.el index 1dc512a..4401c66 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -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))