3 ;; --- OS/2 specific settings & external/internal MIME methods.
5 ;; Author: OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
6 ;; Kazu Yamamoto <Kazu@Mew.org>
7 ;; Created: Dec 18, 1996
8 ;; Revised: Aug 30, 1999
12 (defconst mew-os2-version "mew-os2.el v0.28")
14 (defvar mew-os2-load-hook nil
15 "*Hook called after mew-os2 has been loaded.")
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 (setq mew-cs-text-for-write 'mew-cs-text-crlf)
23 ((featurep 'mew-mule2) ;; 2.3@19.x
24 (if (not (boundp '*ctext*dos))
27 ?X "Coding-system used in X as Compound Text Encoding."
28 t ;; xxx '*ctext*unix, '*ctext*dos, '*ctext*mac, too
29 (list lc-ascii lc-ltn1 lc-invalid lc-invalid
30 nil 'ascii-eol 'ascii-cntl)))
31 (setq mew-cs-scan '*ctext*dos)
32 (setq mew-cs-virtual mew-cs-scan) ;; remove ^M
33 ;; for *.cmd (by NAKAGAWA Takayuki)
34 (require 'os2-process)
36 ((featurep 'mew-mule3) ;; MULE 3.0
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 ;; OS/2 & shell specific variables
45 ;;(setq mew-prog-shell (file-name-nondirectory os2-process-comspec-cmd))
46 ;;(setq mew-prog-shell-arg "/c")
48 ;(setq mew-prog-utime ;; NOT fullpath
49 ; (file-name-nondirectory
50 ; (os2-process-openp "utime" exec-path os2-process-exec-suffixes t)))
51 (setq mew-prog-uncompface "uncompface.exe")
53 (setq mew-prog-mime-encode "mewencode.exe")
54 (setq mew-prog-mime-decode "mewdecode.exe")
56 ;; nsclient: "http://www.t3.rim.or.jp/~homy/"
57 (defvar mew-ext-prog-url "nsclient.exe")
59 (autoload 'browse-url-at-mouse "browse-url" nil t)
60 (autoload 'browse-url-interactive-arg "browse-url" nil t)
62 (defun browse-url-nsclient (url)
63 (interactive (browse-url-interactive-arg "Netscape URL: "))
64 (x-set-selection 'PRIMARY url)
65 (start-process "nsclient" nil "nsclient.exe" url))
67 ;;(add-hook 'mew-init-hook (function (lambda ()
68 ;; (define-key mew-message-mode-map [mouse-2] 'browse-url-at-mouse))))
70 ;;(setq browse-url-browser-function (function browse-url-nsclient))
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74 ;; 'mew-summary-x-face (C-cC-x)
76 ;; => http://web.kyoto-inet.or.jp/people/fuji0924/os2mew.html
78 ;;(setq mew-x-face-filter (list mew-prog-uncompface "icon2xbm")) ;; rexX-Face/icon2xbm.cmd
79 ;;(setq mew-x-face-prog "d:/tool/pmview/pmview.exe") ;; PMview, GBM/2
80 ;;(setq mew-x-face-args '("/Wpos=\(,,,,For\)"))
83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
86 (setq mew-touch-folder-p t)
88 (setenv "PERL_BADLANG" "0")
89 (setenv "PERL_BADFREE" "0")
91 ;; Archive interface for OS/2 imcat
92 (defvar mew-os2/archive-prefix "archived")
93 (defvar mew-os2/archive-suffix ".zip")
95 (defconst mew-os2/archive
96 (concat mew-os2/archive-prefix mew-os2/archive-suffix))
98 (defun mew-os2/archive-exist-p (fld)
99 (file-exists-p (mew-expand-folder fld mew-os2/archive)))
102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
105 (defvar mew-os2/mime-method "mew-mime.cmd")
106 (defvar mew-prog-plain '(mew-mime-text/plain () nil))
107 (defvar mew-prog-enriched '(mew-mime-text/enriched () nil))
108 ;;(defvar mew-prog-html '(mew-mime-text/html () nil))
109 ;; Netscape/nsclient: "x:/foo/bar.html" => "file:///x|/foo/bar.html"
110 (defvar mew-prog-html (list mew-os2/mime-method (list "text/html") t))
111 (defvar mew-prog-text '(mew-mime-text/plain () nil))
112 (defvar mew-prog-audio
113 (list mew-prog-shell (list mew-prog-shell-arg "cat - > /dev/audio") nil))
114 (defvar mew-prog-audio2
115 (list mew-prog-shell (list mew-prog-shell-arg "cat < /dev/audio") nil))
116 (defvar mew-prog-gif (if (and window-system mew-xemacs-p
117 (valid-image-instantiator-format-p 'gif))
118 '(mew-mime-image/gif () nil)
119 (list mew-os2/mime-method (list "image/gif") t)))
120 (defvar mew-prog-jpeg (if (and window-system mew-xemacs-p
121 (valid-image-instantiator-format-p 'jpeg))
122 '(mew-mime-image/jpeg () nil)
123 (list mew-os2/mime-method (list "image/jpeg") t)))
124 (defvar mew-prog-xwd (list mew-os2/mime-method (list "image/x-xwd") t))
126 (if (fboundp 'bitmap-insert-xbm-buffer) ;; bitmap-mule/bitmap.el
127 '(mew-mime-image/x-xbm-for-mule () nil)
128 (if (and window-system mew-xemacs-p
129 (valid-image-instantiator-format-p 'xbm)) ;; XEmacs
130 '(mew-mime-image/xbm () nil)
131 (list mew-os2/mime-method (list "image/x-xbm") t))))
133 (defvar mew-prog-bmp (list mew-os2/mime-method (list "image/x-bmp") t))
134 (defvar mew-prog-image (list mew-os2/mime-method (list "image/oth") t))
135 (defvar mew-prog-mpeg (list mew-os2/mime-method (list "video/mpeg") t))
136 (defvar mew-prog-rfc822 '(mew-mime-message/rfc822 () nil))
137 (defvar mew-prog-external-body '(mew-mime-external-body () nil))
138 (defvar mew-prog-delivery-status '(mew-mime-text/plain () nil))
139 (defvar mew-prog-postscript (list mew-os2/mime-method (list "application/postscript") t))
140 (defvar mew-prog-pgp-keys '(mew-mime-pgp-keys () nil))
141 (defvar mew-prog-octet-stream '(mew-mime-application/octet-stream () nil))
144 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145 ;; other MIME Content-Types & methods
149 (list mew-os2/mime-method (list "audio/x-wav") t))
150 (defvar mew-prog-aiff
151 (list mew-os2/mime-method (list "audio/x-aiff") t))
152 (defvar mew-prog-midi
153 (list mew-os2/mime-method (list "audio/x-midi") t))
156 (defvar mew-prog-os2-bmp
157 (list mew-os2/mime-method (list "image/x-os2-bmp") t))
158 (defvar mew-prog-tiff
159 (list mew-os2/mime-method (list "image/tiff") t))
161 (list mew-os2/mime-method (list "image/x-pic") t))
163 (list mew-os2/mime-method (list "image/x-pcx") t))
165 (list mew-os2/mime-method (list "image/x-prm") t))
167 (list mew-os2/mime-method (list "image/x-pgm") t))
169 (list mew-os2/mime-method (list "image/x-xpm") t))
170 (defvar mew-prog-png (if (and window-system mew-xemacs-p
171 (valid-image-instantiator-format-p 'png))
172 '(mew-mime-image/png () nil)
173 (list mew-os2/mime-method (list "image/png") t)))
174 (defvar mew-prog-meta
175 (list mew-os2/mime-method (list "image/x-os2-meta") t))
178 (defvar mew-prog-msvideo
179 (list mew-os2/mime-method (list "video/x-msvideo") t))
181 (list mew-os2/mime-method (list "video/quicktime") t))
185 (list mew-os2/mime-method (list "application/pdf") t))
187 (list mew-os2/mime-method (list "application/mac-binhex40") t))
188 (defvar mew-prog-view
189 (list mew-os2/mime-method (list "application/x-os2-inf") t))
190 (defvar mew-prog-viewhelp
191 (list mew-os2/mime-method (list "application/x-os2-hlp") t))
192 (defvar mew-prog-caesar-table
193 (if (fboundp 'mew-mime-text/x-rot13-47)
194 '(mew-mime-text/x-rot13-47 () nil)
195 '(mew-mime-text/plain () nil)))
198 (setq mew-mime-content-type (append '(
286 ;; misc (binary file)
287 ("application/octet-stream"
288 "\\.exe$\\|\\.com$\\|\\.cmd$\\|\\.tar\\.?b?z?2?$\\|\\.bz2?$\\|\\.lzh$\\|\\.zip$\\|\\.arj$\\|\\.zoo$\\|\\.rar$\\|\\.img$"
290 mew-prog-octet-stream
291 mew-icon-application/octet-stream
293 ("application/mac-binhex40"
297 mew-icon-application/octet-stream
299 ("application/x-os2-inf"
303 mew-icon-application/octet-stream
305 ("application/x-os2-hlp"
309 mew-icon-application/octet-stream
314 mew-prog-caesar-table
317 ) mew-mime-content-type ))
320 (setq mew-mime-content-type-list (append
322 "application/mac-hexbin40"
323 "application/x-os2-inf"
324 "application/x-os2-hlp"
325 "image/x-os2-bmp" "image/tiff" "image/x-tiff"
326 "image/x-pcx" "image/x-pic" "image/x-xpm"
327 "image/x-prm" "image/x-pgm" "image/x-os2-meta"
328 "audio/x-wav" "audio/x-aiff" "audio/x-midi"
329 "video/x-msvideo" "video/quicktime"
331 mew-mime-content-type-list))
334 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
335 ;; internal method for image/x-xbm. -- 'bitmap-mule/bitmap.el' required.
337 (defun mew-mime-image/x-xbm-for-mule (begin end &optional params execute)
340 (set-buffer (mew-buffer-message))
342 (insert-buffer-substring (mew-current-get 'cache) begin end)
343 (if (or mew-end-of-message-string mew-end-of-part-string) ;; xxx
344 (goto-char (point-max)) ;; necessary?
345 (setq last-point (point-max))
346 (bitmap-insert-xbm-buffer (mew-buffer-message))
347 (delete-region (point-min) last-point)))
348 (set-buffer-modified-p nil) ;; xxx
351 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
352 ;; fasten mew-folder-list() w/ REXX
353 (defvar mew-prog-rxfolders "RxFolders")
355 ;(if (os2-process-openp mew-prog-rxfolders exec-path '(".exe" ".cmd" "") t)
356 ; (setq mew-folder-list-function 'mew-os2/folders-list))
359 (defun mew-os2/folders-list (prefix)
360 (let (folder folders-list
362 ((string= "+" prefix) mew-mail-path)
363 ((string= "=" prefix) mew-news-path))))
365 (call-process mew-prog-rxfolders nil t nil path)
366 (goto-char (point-min))
367 (while (re-search-forward ".+$" nil t)
368 (setq folder (concat prefix (mew-match 0)))
369 (setq folders-list (cons folder folders-list)))
375 (run-hooks 'mew-os2-load-hook)
377 ;;; Copyright Notice:
379 ;; Copyright (C) 1997, 1998, 1999 Mew developing team.
380 ;; All rights reserved.
382 ;; Redistribution and use in source and binary forms, with or without
383 ;; modification, are permitted provided that the following conditions
386 ;; 1. Redistributions of source code must retain the above copyright
387 ;; notice, this list of conditions and the following disclaimer.
388 ;; 2. Redistributions in binary form must reproduce the above copyright
389 ;; notice, this list of conditions and the following disclaimer in the
390 ;; documentation and/or other materials provided with the distribution.
391 ;; 3. Neither the name of the team nor the names of its contributors
392 ;; may be used to endorse or promote products derived from this software
393 ;; without specific prior written permission.
395 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
396 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
397 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
398 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
399 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
400 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
401 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
402 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
403 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
404 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
405 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
407 ;; mew-os2.el ends here