;;; gnus-ems.el --- functions for making Gnus work under different Emacsen
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
(autoload 'appt-select-lowest-window "appt"))
(if (featurep 'xemacs)
- (autoload 'gnus-smiley-display "smiley")
- (autoload 'gnus-smiley-display "smiley-ems")) ; override XEmacs version
+ (autoload 'smiley-region "smiley")
+ (autoload 'smiley-region "smiley-ems")) ; override XEmacs version
(defun gnus-kill-all-overlays ()
"Delete all overlays in the current buffer."
(truncate-string-to-width valstr ,max-width)
valstr)))
+(eval-and-compile
+ (defalias 'gnus-char-width
+ (if (fboundp 'char-width)
+ 'char-width
+ (lambda (ch) 1)))) ;; A simple hack.
+
(eval-and-compile
(if (featurep 'xemacs)
(gnus-xmas-define)
(append nnheader-file-name-translation-alist
(mapcar (lambda (c) (cons c ?_))
'(?: ?* ?\" ?< ?> ??))
- '((?+ . ?-))))))))
+ (if (string-match "windows-nt\\|cygwin32"
+ (symbol-name system-type))
+ nil
+ '((?+ . ?-)))))))))
(defvar gnus-tmp-unread)
(defvar gnus-tmp-replied)
(defvar gnus-article-compface-xbm
(condition-case ()
- (eq 0 (string-match "#define"
+ (eq 0 (string-match "#define"
(shell-command-to-string "uncompface -X")))
(error nil))
"Non-nil means the compface program supports the -X option.
That produces XBM output.")
-(defun gnus-article-display-xface (beg end &optional buffer)
- "Display an XFace header from between BEG and END in BUFFER.
+(defun gnus-article-display-xface (data)
+ "Display the XFace header FACE in the current buffer.
Requires support for images in your Emacs and the external programs
`uncompface', and `icontopbm'. On a GNU/Linux system these
might be in packages with names like `compface' or `faces-xface' and
(make-ring gnus-article-xface-ring-size)))
(save-excursion
(let* ((cur (current-buffer))
- (data (if buffer
- (with-current-buffer buffer
- (buffer-substring beg end))
- (buffer-substring beg end)))
(image (cdr-safe (assoc data (ring-elements
gnus-article-xface-ring-internal))))
default-enable-multibyte-characters)
(when image
(goto-char (point-min))
(re-search-forward "^From:" nil 'move)
- (insert-image image))))))
+ (gnus-add-wash-type 'xface)
+ (gnus-add-image 'xface image)
+ (insert-image image " ")
+ (put-text-property (1- (point)) (point)
+ 'gnus-image-text-deletable t))))))
+
+;;; Image functions.
+
+(defun gnus-image-type-available-p (type)
+ (and (fboundp 'image-type-available-p)
+ (image-type-available-p type)))
+
+(defun gnus-create-image (file)
+ (create-image file))
+
+(defun gnus-put-image (glyph &optional string)
+ (insert-image glyph string))
+
+(defun gnus-remove-image (image)
+ (dolist (position (message-text-with-property 'display))
+ (when (equal (get-text-property position 'display) image)
+ (put-text-property position (1+ position) 'display nil)
+ (if (get-text-property position 'gnus-image-text-deletable)
+ (delete-region position (1+ position))))))
(provide 'gnus-ems)