Gnus development mailing list
 help / color / mirror / Atom feed
* Using tm w/Gnus on NTEmacs?
@ 1996-11-25 21:31 Michael Welsh Duggan
  1996-11-26 22:35 ` Mats Lidell
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Welsh Duggan @ 1996-11-25 21:31 UTC (permalink / raw)


Has anyone successfully managed to get tm working with Gnus under
NTEmacs?  If so, how have you set up the tm package?

Gnus v5.2.37; nnml 1.0; nnfolder 1.0
GNU Emacs 19.32.1 (i386-*-nt3.51)

-- 
Michael Duggan
(md5i@schenley.com)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using tm w/Gnus on NTEmacs?
  1996-11-25 21:31 Using tm w/Gnus on NTEmacs? Michael Welsh Duggan
@ 1996-11-26 22:35 ` Mats Lidell
  0 siblings, 0 replies; 3+ messages in thread
From: Mats Lidell @ 1996-11-26 22:35 UTC (permalink / raw)
  Cc: ding, ntemacs-users

>>>>> "Michael" == Michael Welsh Duggan <md5i@schenley.com> writes:

    Michael> Has anyone successfully managed to get tm working with
    Michael> Gnus under NTEmacs?  

Yes and no ;-) The simple MIME things in e-lisp works but since
decoding more complex stuff needs support from external processes, and
those are written in sh(1), it is not simple to get that to work under
NT.

I'm in the process of installing the Gnu utilities and I hope then
that I'll get the more complex things working to. Right!?

    Michael> If so, how have you set up the tm package?

I just load mime-setup. Didn't do anything special.

I'm using:
   gnus-version's value is "Red Gnus v0.60"
   tm-7.93
   emacs-version's value is "19.34.1"

%% Mats


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using tm w/Gnus on NTEmacs?
@ 1996-11-26 23:04 Fabrice POPINEAU
  0 siblings, 0 replies; 3+ messages in thread
From: Fabrice POPINEAU @ 1996-11-26 23:04 UTC (permalink / raw)
  Cc: ntemacs-users, ding

I tried to port what has been done with tm/os2 on win32, but failed
to get the rexx scripts running under nt.

So I rewrote a tm-win32 without any shell script that can decode and play
images, sounds, mpeg, winword files and so on.

You need mmencode.exe and metamail.exe plus tm-win32.el. There are still
some glitches (right buffer isn't restored) but if somebody wants to take 
a look at it...

This function from tm-play.el needs to be modified.

;;; @ external decoder
;;;

(defun mime-article/start-external-method-region (beg end cal)
  (save-excursion
    (save-restriction
      (narrow-to-region beg end)
      (goto-char beg)
      (let ((method (cdr (assoc 'method cal)))
	    (name (mime-article/get-filename cal))
	    )
	(if method
	    (let ((file (make-temp-name
			 (expand-file-name "TM" mime/tmp-dir)))
		  b args)
	      (if (nth 1 method)
		  (setq b beg)
		(setq b
		      (if (re-search-forward "^$" nil t)
			  (1+ (match-end 0))
			(point-min)
			))
		)
	      (goto-char b)
	      (write-region b end file)
	      (message "External method is starting...")
	      (setq cal (put-alist
			 'name (replace-as-filename name) cal))
	      (setq cal (put-alist 'file file cal))
	      (setq args (nconc
			  (list (car method)
				mime/output-buffer-name (car method)
				)
			  (mime-article/make-method-args cal
							 (cdr (cdr method)))
			  ))
;;	      (apply (function start-process) args)
	      (tm-external-decode args)
	      (mime-article/show-output-buffer)
	      ))
	))))

Here is tm-win32.el. Let me know if you need the executables.

Fabrice POPINEAU
---------------------------------------------------------------------------
;;;
;;; $Id: tm-os2.el,v 7.20 1996/10/27 15:05:22 H.Ueno Exp $
;;;
;;; Setting a MIME extension under OS/2 environment for tm.
;;; by Hiroshi Ueno <zodiac@ibm.net>
;;;

(require 'tl-atype)
(require 'tl-str)
(require 'tl-misc)
(require 'tm-setup)

;;
;; variables
;;
(defvar tm-win32/show-x-face nil)

;;
;; For tm-view.  Define the internal and external methods for each
;; content type for MIME decoding.
;;
(call-after-loaded 'tm-view
  (function (lambda ()
;
    (if (file-installed-p "mailcrypt.el")
      (require 'tm-pgp))
;;
;; To show X-Face image inline, uncompface.exe from compface package
;; is required.
;;
    (cond ((and window-system
		tm-win32/show-x-face
		(boundp 'MULE)
		(file-installed-p "uncompface.exe" exec-path))
	  (require 'tm-image)))
;
    (set-atype 'mime/content-decoding-condition
      '((type . "text/plain")
        (method "tm-plain" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "text/html")
        (method "tm-html" () 'file 'type 'encoding 'mode 'name)
	(mode . "play")))
    (set-atype 'mime/content-decoding-condition
      '((type . "audio/basic")
        (method "tm-au"    () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "audio/x-aiff")
        (method "tm-au"    () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "audio/x-wav")
        (method "tm-au"    () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/gif")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/jpeg")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/tiff")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-tiff")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-xbm")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-pic")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-pcx")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-portable-pixmap")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-portable-graymap")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "image/x-win32-bmp")
        (method "tm-image" () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "video/mpeg")
        (method "tm-mpeg"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "video/x-msvideo")
        (method "tm-mpeg"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "video/quicktime")
        (method "tm-mpeg"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/octet-stream")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/x-zip-compressed")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/zip")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/x-tar")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/x-gzip")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "message/rfc822")
        (method "tm-file"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((type . "application/mac-binhex40")
        (method "tm-mac"  () 'file 'type 'encoding 'mode 'name)))
    (set-atype 'mime/content-decoding-condition
      '((method "tm-file" () 'file 'type 'encoding 'mode 'name)
        (mode . "extract")))
  )))
;;
;; Set a coding system of the MIME output buffer.
;;
(cond ((boundp 'MULE)
       (define-program-coding-system "*MIME-out*" nil *autoconv*)
       )
      ((boundp 'NEMACS)
       (define-program-kanji-code "*MIME-out*" nil 'sjis)
       ))
;;
;; Add some content types for composing MIME messages.
;;
(call-after-loaded 'tm-edit
  (function (lambda ()
    (put-alist "image"
      '(("gif")
        ("jpeg")
        ("x-pic")
        ("tiff")
        ("x-pcx")
        ("x-win32-bmp")
        ("x-mag")
        ("x-xwd")
        ("x-xbm")) mime-content-types)
    (put-alist "audio"
      '(("basic")
        ("x-aiff")
        ("x-wav")) mime-content-types)
    (put-alist "video"
      '(("mpeg")
        ("x-msvideo")
        ("quicktime")) mime-content-types)

    (setq mime-file-types (append
      '(("\\.pcx$"
	 "image"    "x-pcx"      nil
	 "base64"
	 "inline"	(("filename" . file))
	 )
        ("\\.tif$"
	 "image"    "tiff"       nil
	 "base64"
	 "inline"	(("filename" . file))
	 )
        ("\\.wav$"
	 "audio"    "x-wav"      nil
	 "base64"
	 "attachment"	(("filename" . file))
	 )
        ("\\.aif$"
	 "audio"    "x-aiff"     nil
	 "base64"
 	 "attachment"	(("filename" . file))
	 )
        ("\\.mov$"
	 "video"    "quicktime"  nil
	 "base64"
	 "attachment"	(("filename" . file))
	 )
        ("\\.qt$"
	 "video"    "quicktime"  nil
	 "base64"
	 "attachment"	(("filename" . file))
	 )
        ("\\.avi$"
	 "video"    "x-msvideo"  nil
	 "base64"
	 "attachment"	(("filename" . file))
	))
      mime-file-types))
;;
;; Redefine the program coding system of uuencode-external-encoder
;;
    (cond ((boundp 'MULE)
           (require 'mel-u)
           (define-program-coding-system
             nil (car uuencode-external-encoder) '(*autoconv* . *noconv*))
          ))
  )))
;;
;; List of invalid characters for filename.
;;
(setq filename-special-char-range
      (nconc '((0 . 31))
	     (string-to-int-list "\"")
	     (list (cons (char-int ?&) (char-int ?*)))
	     (string-to-int-list ",/")
	     (list (cons (char-int ?:) (char-int ??)))
	     (string-to-int-list "\\^`")
	     (list (cons (char-int ?{) (char-int ?})))
	     '((127 . 255))))
;;
;; Override uuencode-external-decoder
;;
(setq mime/tmp-dir (or (getenv "TM_TMP_DIR")
		       (getenv "TMP") "./"))
(setq uuencode-external-decoder
  (list "cmd" "/c" (format "cd %s & uudecode" mime/tmp-dir)))

;;
;; Simulate all tm-* methods
;;

(defun tm-external-decode (args)
  (let ((appli (symbol-concat "tm-win32-" (nth 2 args)))
	(buffer (nth 1 args))
	(tmpfile (nth 3 args))
	(type (nth 4 args))
	(subtype (nth 5 args))
	(action (nth 6 args))
	(filename (nth 7 args)))
    (save-excursion
      (switch-to-buffer (get-buffer buffer))
      (apply appli
	       (list tmpfile type subtype action filename))
      )
    )
  )

(defvar tm-win32-env-alist
  '(("audio/basic" "TM_VIEW_AU_BASIC" ".au")
    ("audio/x-aiff" "TM_VIEW_AU_AIFF" ".aif")
    ("audio/x-wav" "TM_VIEW_AU_WAV" ".wav")
    ("image/gif" "TM_VIEW_IMAGE_GIF" ".gif")
    ("image/jpeg" "TM_VIEW_IMAGE_JPEG" ".jpg")
    ("image/tiff" "TM_VIEW_IMAGE_TIFF" ".tif")
    ("image/x-tiff" "TM_VIEW_IMAGE_TIFF" ".tif")
    ("image/x-xbm" "TM_VIEW_IMAGE_XBM" ".xbm")
    ("image/x-pic" "TM_VIEW_IMAGE_PIC" ".pic")
    ("image/x-pcx" "TM_VIEW_IMAGE_PCX" ".pcx")
    ("image/x-portable-pixmap" "TM_VIEW_IMAGE_PPM" ".ppm")
    ("image/x-portable-graymap" "TM_VIEW_IMAGE_PGM" ".pgm")
    ("video/mpeg" "TM_VIEW_VIDEO_MPEG" ".mpg")
    ("video/x-msvideo" "TM_VIEW_VIDEO_AVI" ".avi")
    ("video/quicktime" "TM_VIEW_VIDeO_MOV" ".mov")
    )
  )

(defun tm-win32-tm-au (tmpfile type subtype action filename)
  (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_AU")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
  )

(defun tm-win32-tmexecute (action viewer filename)
  (cond ((string= action "extract") (message (concat "Extract to " filename)))
	((string= action "play") (apply (function start-process)
					(list viewer 
					      (buffer-name (current-buffer))
					      viewer
					      filename)))
	(t (message (concat "Unkown action : " action))))
  )

(defun tm-win32-tm-file (tmpfile type subtype action filename)
  (let* ((filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (viewer "shelex")
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
)

(defun tm-win32-tm-html (tmpfile type subtype action filename)
  (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_WWW_BROWSER")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
)

(defun tm-win32-tm-image (tmpfile type subtype action filename)
    (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_IMAGE")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
)

(defun tm-win32-tm-mac (tmpfile type subtype action filename)
  (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_MAC")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
)

(defun tm-win32-tm-mpeg (tmpfile type subtype action filename)
  (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_VIDEO")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
)

(defun tm-win32-tm-plain (tmpfile type subtype action filename)
  (let* ((envvar (cdr (assoc type tm-win32-env-alist)))
	 (extension (and envvar (cadr envvar)))
	 (envvar (and envvar (car envvar)))
	 (viewer (or (getenv "TM_VIEW_PLAIN")
		     (and envvar (getenv envvar))
		     "shelex"))
	 (filename (if (or (null filename)
			   (string= filename ""))
		       (make-temp-name (concat mime/tmp-dir "/mime"))
		     (concat mime/tmp-dir "/" filename)))
	 (filename (concat filename extension))
	 )
    (tm-win32-tmdecode subtype tmpfile filename mime/tmp-dir)
    (tm-win32-tmexecute action viewer filename)
    )
  )

(defun tm-win32-tmdecode (subtype tmpfile filename savedir)
  (cond ((or (null subtype) (string= subtype ""))
	 (copy-file tmpfile filename))
	((or (string= subtype "7bit") (string= subtype "8bit")
	     (string= subtype "binary"))
	 (copy tmpfile filename))
	((or (string= subtype "x-uue") (string= subtype "x-uuencode"))
	 (if (file-directory-p savedir)
	     (start-process "uudecode" nil "uudecode" tmpfile)
	   (message (concat "Can't find " savedir))))
	((string= subtype "base64")
	 (start-process "uudecode" nil "mmencode" "-u -o" filename tmpfile))
	((string= subtype "quoted-printable")
	 (start-process "uudecode" nil "mmencode" "-q -u -o" filename tmpfile))
	((string= subtype "x-gzip64")
	 (start-process "mmencode" nil (concat "mmencode -u " tmpfile
					       " | gzip -dc > " filename)))
	(t (message (concat "Unkown encoding : " subtype))
	   (delete-file tmpfile))
	)
  )


;;
;; Override x-gzip64 encoder/decode
;;
(setq gzip64-external-encoder '("cmd" "/c" "gzip -c | mmencode"))
(setq gzip64-external-decoder '("cmd" "/c" "mmencode -u | gzip -dc"))

(require 'mel-g)
;;
;; end of tm-os2.el
;;
(provide 'tm-os2)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-11-26 23:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-25 21:31 Using tm w/Gnus on NTEmacs? Michael Welsh Duggan
1996-11-26 22:35 ` Mats Lidell
1996-11-26 23:04 Fabrice POPINEAU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).