* gnus-art.el (gnus-add-wash-type): Use add-to-list.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 19 Jan 2002 20:05:15 +0000 (20:05 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 19 Jan 2002 20:05:15 +0000 (20:05 +0000)
* smiley-ems.el (smiley-region): Register smiley.
(smiley-toggle-buffer): Rewrite the function.
(smiley-active): Removed.

lisp/ChangeLog
lisp/gnus-art.el
lisp/smiley-ems.el

index 1282f63..7403424 100644 (file)
@@ -1,3 +1,11 @@
+2002-01-19  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-art.el (gnus-add-wash-type): Use add-to-list.
+
+       * smiley-ems.el (smiley-region): Register smiley.
+       (smiley-toggle-buffer): Rewrite the function.
+       (smiley-active): Removed.
+
 2002-01-19  Simon Josefsson  <jas@extundo.com>
 
        * gnus-util.el (gnus-parent-id): Optimize null n case.  From
index cdd2a07..7888afe 100644 (file)
@@ -4373,7 +4373,7 @@ is the string to use when it is inactive.")
 
 (defun gnus-add-wash-type (type)
   "Add a washing of TYPE to the current status."
-  (push type gnus-article-wash-types))
+  (add-to-list 'gnus-article-wash-types type))
 
 (defun gnus-delete-wash-type (type)
   "Add a washing of TYPE to the current status."
index a5c1a5c..1cb263d 100644 (file)
@@ -37,6 +37,7 @@
 
 (eval-when-compile (require 'cl))
 (require 'nnheader)
+(require 'gnus-art)
 
 (defgroup smiley nil
   "Turn :-)'s into real images."
@@ -102,10 +103,6 @@ regexp to replace with IMAGE.  IMAGE is the name of a PBM file in
            (push (list (car elt) (cadr elt) image)
                  smiley-cached-regexp-alist)))))))
 
-(defvar smiley-active nil
-  "Non-nil means smilies in the buffer will be displayed.")
-(make-variable-buffer-local 'smiley-active)
-
 (defvar smiley-mouse-map
   (let ((map (make-sparse-keymap)))
     (define-key map [down-mouse-2] 'ignore) ; override widget
@@ -126,7 +123,6 @@ A list of images is returned."
            (overlays-in start end))
     (unless smiley-cached-regexp-alist
       (smiley-update-cache))
-    (setq smiley-active t)
     (save-excursion
       (let ((beg (or start (point-min)))
            group overlay image images)
@@ -137,6 +133,8 @@ A list of images is returned."
          (while (re-search-forward (car entry) end t)
            (when image
              (push image images)
+             (gnus-add-wash-type 'smiley)
+             (gnus-add-image 'smiley image)
              (add-text-properties
               (match-beginning group) (match-end group)
               `(display ,image
@@ -147,12 +145,15 @@ A list of images is returned."
        images))))
 
 (defun smiley-toggle-buffer (&optional arg)
-  "Toggle displaying smiley faces.
+  "Toggle displaying smiley faces in article buffer.
 With arg, turn displaying on if and only if arg is positive."
   (interactive "P")
-  (if (numberp arg)
-      (setq smiley-active (> arg 0))
-    (setq smiley-active (not smiley-active))))
+  (gnus-with-article-buffer
+    (if (if (numberp arg) 
+           (> arg 0)
+         (not (memq 'smiley gnus-article-wash-types)))
+       (smiley-region (point-min) (point-max))
+      (gnus-delete-images 'smiley))))
 
 (defun smiley-mouse-toggle-buffer (event)
   "Toggle displaying smiley faces.