* liece-channel.el (liece-channel-redisplay-buffer): New hook
authorbg66 <bg66>
Tue, 5 Sep 2000 04:47:16 +0000 (04:47 +0000)
committerbg66 <bg66>
Tue, 5 Sep 2000 04:47:16 +0000 (04:47 +0000)
`liece-channel-read-hook'.
(liece-channel-change): Run `liece-redisplay-unread-mark'.

* liece-handle.el (liece-handle-privmsg-message): New hook
`liece-channel-unread-hook'.

* liece-vars.el (liece-display-unread-mark): New variable.

* liece-xemacs.el (liece-xemacs-unread-icon): Rename from
`liece-xemacs-channel-balloon-icon'.
(liece-xemacs-unread-mark): Rename and simplified from
`liece-xemacs-channel-balloon'.
(liece-xemacs-read-mark): Rename and simplefied from
`liece-xemacs-channel-balloon-kill'.
(liece-xemacs-redisplay-unread-mark): New function.
(toplevel): Add them to hook.

* liece-emacs.el (liece-emacs-unread-character): New variable.
(liece-emacs-unread-mark): New function.
(liece-emacs-read-mark): Ditto.
(liece-emacs-redisplay-unread-mark): Ditto.
(toplevel): Add them to hook.

lisp/ChangeLog
lisp/liece-channel.el
lisp/liece-emacs.el
lisp/liece-handle.el
lisp/liece-vars.el
lisp/liece-xemacs.el

index f6b138c..8100a66 100644 (file)
@@ -1,3 +1,29 @@
+2000-09-05  Akira Ohashi  <bg66@luck.gr.jp>
+
+       * liece-channel.el (liece-channel-redisplay-buffer): New hook
+       `liece-channel-read-hook'.
+       (liece-channel-change): Run `liece-redisplay-unread-mark'.
+
+       * liece-handle.el (liece-handle-privmsg-message): New hook
+       `liece-channel-unread-hook'.
+
+       * liece-vars.el (liece-display-unread-mark): New variable.
+
+       * liece-xemacs.el (liece-xemacs-unread-icon): Rename from
+       `liece-xemacs-channel-balloon-icon'.
+       (liece-xemacs-unread-mark): Rename and simplified from
+       `liece-xemacs-channel-balloon'.
+       (liece-xemacs-read-mark): Rename and simplefied from
+       `liece-xemacs-channel-balloon-kill'.
+       (liece-xemacs-redisplay-unread-mark): New function.
+       (toplevel): Add them to hook.
+
+       * liece-emacs.el (liece-emacs-unread-character): New variable.
+       (liece-emacs-unread-mark): New function.
+       (liece-emacs-read-mark): Ditto.
+       (liece-emacs-redisplay-unread-mark): Ditto.
+       (toplevel): Add them to hook.
+
 2000-09-04   Daiki Ueno  <ueno@unixuser.org>
 
        * liece-inlines.el (string-equal-ignore-case): Check return value
index c484e79..c11ca08 100644 (file)
@@ -385,6 +385,7 @@ If NOSW is non-nil do not switch to newly created channel."
     (when chnl
       (save-excursion
        (run-hook-with-args 'liece-redisplay-buffer-functions chnl)))
+    (liece-redisplay-unread-mark)
     (liece-configure-windows)))
 
 (defsubst liece-channel-set-operator-1 (chnl user val)
@@ -503,9 +504,10 @@ If NOSW is non-nil do not switch to newly created channel."
         (cdr (string-assoc-ignore-case
               chnl liece-channel-buffer-alist)))
        (window (liece-get-buffer-window liece-channel-buffer)))
-    (and (liece-channel-unread-p chnl)
-        (setq liece-channel-unread-list
-              (delete chnl liece-channel-unread-list)))
+    (when (liece-channel-unread-p chnl)
+      (setq liece-channel-unread-list
+           (delete chnl liece-channel-unread-list))
+      (run-hook-with-args 'liece-channel-read-hook chnl))
     (and buffer window
         (with-current-buffer buffer
           (set-window-buffer window buffer)
index 7a1e9c7..dee2eda 100644 (file)
   (autoload 'bitmap-stipple-xbm-file-to-stipple "bitmap-stipple")
   (autoload 'bitmap-stipple-insert-pixmap "bitmap-stipple"))
 
+(defcustom liece-emacs-unread-character "!"
+  "Unread character."
+  :type 'character
+  :group 'liece-look)
+
 ;;; @ widget emulation
 ;;; 
 (defvar liece-widget-keymap nil)
                                         'rear-nonsticky (list 'display))))
            (beginning-of-line 2)))))))
 
+;;; @ unread mark
+;;; 
+(defun liece-emacs-unread-mark (chnl)
+  (if liece-display-unread-mark
+    (with-current-buffer liece-channel-list-buffer
+      (let ((buffer-read-only nil))
+       (goto-char (point-min))
+       (when (re-search-forward (concat "^ ?[0-9]+: " chnl "$") nil t)
+          (goto-char (match-end 0))
+         (insert (concat " " liece-emacs-unread-character)))))))
+
+(defun liece-emacs-read-mark (chnl)
+  (if liece-display-unread-mark
+    (with-current-buffer liece-channel-list-buffer
+      (let ((buffer-read-only nil))
+        (goto-char (point-min))
+        (when (re-search-forward
+              (concat "^ ?[0-9]+: " chnl " "
+                      liece-emacs-unread-character "$") nil t)
+         (goto-char (- (match-end 0) 2))
+        (delete-char 2))))))
+
+(defun liece-emacs-redisplay-unread-mark ()
+  (if liece-display-unread-mark
+    (let ((chnl))
+      (dolist (chnl liece-channel-unread-list)
+        (liece-emacs-unread-mark chnl)))))
+
 (add-hook 'liece-nick-insert-hook 'liece-emacs-nick-image-region)
 (add-hook 'liece-nick-replace-hook 'liece-emacs-nick-image-region)
        
 (and liece-splash-image window-system
      (liece-emacs-splash))
 
+(fset 'liece-redisplay-unread-mark 'liece-emacs-redisplay-unread-mark)
+(add-hook 'liece-channel-unread-hook 'liece-emacs-unread-mark)
+(add-hook 'liece-channel-read-hook 'liece-emacs-read-mark)
+
 (provide 'liece-emacs)
 
 ;;; liece-emacs.el ends here
index 8aa1d78..522282e 100644 (file)
            (setq liece-channel-unread-list
                  (delete chnl liece-channel-unread-list)))
        (setq liece-channel-unread-list
-             (cons chnl liece-channel-unread-list))))
+             (cons chnl liece-channel-unread-list))
+      (run-hook-with-args 'liece-channel-unread-hook chnl)))
 
     (if (and (liece-nick-equal chnl liece-real-nickname)
             (not (liece-nick-equal prefix liece-current-chat-partner)))
index 0cfd043..c481d43 100644 (file)
   :type 'boolean
   :group 'liece-look)
 
+(defcustom liece-display-unread-mark nil
+  "If non-nil, display unread mark as XEmacs glyphs or character to channel
+list buffer."
+  :type 'boolean
+  :group 'liece-look)
+
 (defcustom liece-tab-stop-list '(2 4 6 8 10 12 14 16)
   "List of tab stop positions in dialogue buffer."
   :type '(repeat integer)
index cf04d33..37d30aa 100644 (file)
@@ -131,8 +131,8 @@ If it is non-nil, it must be a toolbar.  The five valid values are
   :type 'liece-toolbar-icon
   :group 'liece-toolbar-icons)
 
-(defcustom liece-xemacs-channel-balloon-icon "balloon.xpm"
-  "Balloon icon."
+(defcustom liece-xemacs-unread-icon "balloon.xpm"
+  "Unread icon."
   :type 'file
   :group 'liece-look)
 
@@ -555,45 +555,37 @@ If ARG is given, don't hide splash buffer."
 (or (eq 'stream (device-type))
     (liece-xemacs-splash))
 
-;;; @ channel balloon
+;;; @ unread mark
 ;;; 
-;;; To use:
-;;; (and (featurep 'xpm)
-;;;      (memq (console-type) '(x mswindows))
-;;;      (add-hook 'liece-privmsg-cleartext-hook
-;;;               'liece-xemacs-channel-balloon)
-;;;      (add-hook 'liece-redisplay-buffer-functions
-;;;               'liece-xemacs-channel-balloon-kill))
-;;; 
-(defun liece-xemacs-channel-balloon (prefix rest)
-  (with-current-buffer liece-channel-list-buffer
-    (let* ((buffer-read-only nil)
-          (file (liece-xemacs-icon-path
-                 liece-xemacs-channel-balloon-icon))
-          (glyph (make-glyph (vector 'xpm ':file file)))
-          ext)
-      (multiple-value-bind (chnl) (liece-split-line rest)
-       (setq chnl (liece-channel-virtual chnl))
+(defun liece-xemacs-unread-mark (chnl)
+  (if liece-display-unread-mark
+    (with-current-buffer liece-channel-list-buffer
+      (let* ((buffer-read-only nil)
+             (file (liece-xemacs-icon-path
+                   liece-xemacs-unread-icon))
+            (glyph (make-glyph (vector 'xpm ':file file)))
+            ext)
+       (goto-char (point-min))
+       (when (re-search-forward (concat "^ ?[0-9]+: " chnl "$") nil t)
+          (goto-char (match-end 0))
+         (insert " ")
+         (setq ext (make-extent (match-end 0) (1+ (match-end 0))))
+         (set-extent-end-glyph ext glyph))))))
+
+(defun liece-xemacs-read-mark (chnl)
+  (if liece-display-unread-mark
+    (with-current-buffer liece-channel-list-buffer
+      (let ((buffer-read-only nil))
        (goto-char (point-min))
-       (and (liece-channel-p (liece-channel-real chnl))
-            (not (string= liece-current-channel chnl))
-            (re-search-forward (concat "^ ?[0-9]+: " chnl "$") nil t)
-            (progn
-              (goto-char (match-end 0))
-              (insert " ")
-              (setq ext (make-extent (match-end 0) (1+ (match-end 0))))
-              (set-extent-end-glyph ext glyph))))
-      nil)))
-
-(defun liece-xemacs-channel-balloon-kill (chnl)
-  (with-current-buffer liece-channel-list-buffer
-    (let ((buffer-read-only nil))
-      (goto-char (point-min))
-      (and (liece-channel-p (liece-channel-real chnl))
-          (re-search-forward (concat "^ ?[0-9]+: " chnl " $") nil t)
-          (progn
-            (goto-char (1- (match-end 0)))
-            (delete-char 1))))))
+       (when (re-search-forward (concat "^ ?[0-9]+: " chnl " $") nil t)
+          (goto-char (1- (match-end 0)))
+         (delete-char 1))))))
+
+(defun liece-xemacs-redisplay-unread-mark ()
+  (if liece-display-unread-mark
+    (let ((chnl))
+      (dolist (chnl liece-channel-unread-list)
+        (liece-xemacs-unread-mark chnl)))))
 
 \f
 ;;; @ emulation functions
@@ -628,6 +620,16 @@ If ARG is given, don't hide splash buffer."
 (add-hook 'liece-nick-replace-hook 'liece-xemacs-glyph-nick-region)
 (add-hook 'liece-nick-replace-hook 'liece-xemacs-set-drop-functions)
 
+(if (and (featurep 'xpm)
+        (memq (console-type) '(x gtk mswindows)))
+    (progn
+      (fset 'liece-redisplay-unread-mark 'liece-xemacs-redisplay-unread-mark)
+      (add-hook 'liece-channel-unread-hook 'liece-xemacs-unread-mark)
+      (add-hook 'liece-channel-read-hook 'liece-xemacs-read-mark))
+  (fset 'liece-redisplay-unread-mark 'liece-emacs-redisplay-unread-mark)
+  (add-hook 'liece-channel-unread-hook 'liece-emacs-unread-mark)
+  (add-hook 'liece-channel-read-hook 'liece-emacs-read-mark))
+
 (provide 'liece-xemacs)
 
 ;;; liece-xemacs.el ends here