+(defun smiley-toggle-buffer (&optional arg buffer st nd)
+ "Toggle displaying smiley faces.
+With arg, turn displaying on if and only if arg is positive."
+ (interactive "P")
+ (let (on off)
+ (map-extents
+ (lambda (e void)
+ (let (ant)
+ (if (annotationp (setq ant (extent-property e 'smiley-annotation)))
+ (if (eq (extent-property e 'invisible) nil)
+ (setq off (cons (cons ant e) off))
+ (setq on (cons (cons ant e) on)))))
+ nil)
+ buffer st nd)
+ (if (and (not (and (numberp arg) (< arg 0)))
+ (or (and (numberp arg) (> arg 0))
+ (null on)))
+ (if off
+ (while off
+ (reveal-annotation (caar off))
+ (set-extent-property (cdar off) 'invisible t)
+ (setq off (cdr off)))
+ (smiley-buffer))
+ (while on
+ (hide-annotation (caar on))
+ (set-extent-property (cdar on) 'invisible nil)
+ (setq on (cdr on))))))
+