comparison lisp/gnus/mm-decode.el @ 91204:53108e6cea98

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 09:51:45 +0000
parents 880960b70474 1cdfc94602cb
children 2fcaae6177a5
comparison
equal deleted inserted replaced
91203:db40129142b2 91204:53108e6cea98
893 (done (format "Displaying %s...done" command)) 893 (done (format "Displaying %s...done" command))
894 ;; In particular, the timer object (which is 894 ;; In particular, the timer object (which is
895 ;; a vector in Emacs but is a list in XEmacs) 895 ;; a vector in Emacs but is a list in XEmacs)
896 ;; requires that it is lexically scoped. 896 ;; requires that it is lexically scoped.
897 (timer (run-at-time 2.0 nil 'ignore))) 897 (timer (run-at-time 2.0 nil 'ignore)))
898 (if (boundp 'itimer-list) 898 (if (featurep 'xemacs)
899 (lambda (process state) 899 (lambda (process state)
900 (when (eq 'exit (process-status process)) 900 (when (eq 'exit (process-status process))
901 (if (memq timer itimer-list) 901 (if (memq timer itimer-list)
902 (set-itimer-function timer fn) 902 (set-itimer-function timer fn)
903 (funcall fn)) 903 (funcall fn))
1362 'data-p) 1362 'data-p)
1363 (mm-create-image-xemacs type)))) 1363 (mm-create-image-xemacs type))))
1364 (mm-handle-set-cache handle spec)))))) 1364 (mm-handle-set-cache handle spec))))))
1365 1365
1366 (defun mm-create-image-xemacs (type) 1366 (defun mm-create-image-xemacs (type)
1367 (cond 1367 (when (featurep 'xemacs)
1368 ((equal type "xbm") 1368 (cond
1369 ;; xbm images require special handling, since 1369 ((equal type "xbm")
1370 ;; the only way to create glyphs from these 1370 ;; xbm images require special handling, since
1371 ;; (without a ton of work) is to write them 1371 ;; the only way to create glyphs from these
1372 ;; out to a file, and then create a file 1372 ;; (without a ton of work) is to write them
1373 ;; specifier. 1373 ;; out to a file, and then create a file
1374 (let ((file (mm-make-temp-file 1374 ;; specifier.
1375 (expand-file-name "emm" mm-tmp-directory) 1375 (let ((file (mm-make-temp-file
1376 nil ".xbm"))) 1376 (expand-file-name "emm" mm-tmp-directory)
1377 (unwind-protect 1377 nil ".xbm")))
1378 (progn 1378 (unwind-protect
1379 (write-region (point-min) (point-max) file) 1379 (progn
1380 (make-glyph (list (cons 'x file)))) 1380 (write-region (point-min) (point-max) file)
1381 (ignore-errors 1381 (make-glyph (list (cons 'x file))))
1382 (delete-file file))))) 1382 (ignore-errors
1383 (t 1383 (delete-file file)))))
1384 (make-glyph 1384 (t
1385 (vector 1385 (make-glyph
1386 (or (mm-image-type-from-buffer) 1386 (vector
1387 (intern type)) 1387 (or (mm-image-type-from-buffer)
1388 :data (buffer-string)))))) 1388 (intern type))
1389 :data (buffer-string)))))))
1389 1390
1390 (defun mm-image-fit-p (handle) 1391 (defun mm-image-fit-p (handle)
1391 "Say whether the image in HANDLE will fit the current window." 1392 "Say whether the image in HANDLE will fit the current window."
1392 (let ((image (mm-get-image handle))) 1393 (let ((image (mm-get-image handle)))
1393 (or (not image) 1394 (or (not image)
1394 (if (fboundp 'glyph-width) 1395 (if (featurep 'xemacs)
1395 ;; XEmacs' glyphs can actually tell us about their width, so 1396 ;; XEmacs' glyphs can actually tell us about their width, so
1396 ;; lets be nice and smart about them. 1397 ;; lets be nice and smart about them.
1397 (or mm-inline-large-images 1398 (or mm-inline-large-images
1398 (and (<= (glyph-width image) (window-pixel-width)) 1399 (and (<= (glyph-width image) (window-pixel-width))
1399 (<= (glyph-height image) (window-pixel-height)))) 1400 (<= (glyph-height image) (window-pixel-height))))