| 1 |
;;; mew-win32.el --- Settings for Mew on Win32 |
| 2 |
|
| 3 |
;; Author: Shuichi Kitaguchi <[email protected]> |
| 4 |
;; Created: Dec 05, 1997 |
| 5 |
|
| 6 |
(require 'mew) |
| 7 |
(eval-when-compile |
| 8 |
(require 'mew-env0)) |
| 9 |
|
| 10 |
;;; Code: |
| 11 |
|
| 12 |
(eval-when-compile |
| 13 |
(mew-no-warning-defvar w32-start-process-show-window) |
| 14 |
(mew-no-warning-defun mw32script-init) |
| 15 |
(mew-no-warning-defun mw32script-make-pathext-regexp) |
| 16 |
(mew-no-warning-defun mw32script-openp) |
| 17 |
(mew-no-warning-defun mw32script-argument-editing-function) |
| 18 |
(mew-no-warning-defun dos-to-unix-filename)) |
| 19 |
|
| 20 |
;;; for NTEmacs User |
| 21 |
;; |
| 22 |
;; put mw32script.el (in Meadow's archive) into load-path. |
| 23 |
;; |
| 24 |
|
| 25 |
;; |
| 26 |
;; ~/.mew settings |
| 27 |
;; |
| 28 |
|
| 29 |
;;; for PRINTING |
| 30 |
;; mew-w32-prog-print --- print command |
| 31 |
;; mew-w32-prog-print-arg --- print command argument |
| 32 |
;; mew-w32-cs-print --- coding-system for printing |
| 33 |
;; define-process-argument-editing --- for argument-editing |
| 34 |
;; |
| 35 |
;;; example |
| 36 |
;; (setq mew-w32-prog-print "notepad.exe") |
| 37 |
;; (setq mew-w32-prog-print-arg "/p") |
| 38 |
;; (setq mew-w32-cs-print 'shift_jis-dos) ;; Meadow |
| 39 |
;; (define-process-argument-editing "/notepad\\.exe$" |
| 40 |
;; (lambda (x) |
| 41 |
;; (general-process-argument-editing-function x nil t))) |
| 42 |
;; (setq mew-print-function 'mew-w32-print-buffer) |
| 43 |
|
| 44 |
|
| 45 |
;; Emacs version dependent variables. |
| 46 |
(cond |
| 47 |
((featurep 'meadow) ;; Meadow |
| 48 |
(require 'mw32script) |
| 49 |
(mw32script-init)) |
| 50 |
((condition-case nil |
| 51 |
(progn |
| 52 |
(require 'mw32script) |
| 53 |
(load "mw32misc")) |
| 54 |
(file-error nil)) ;; NTEmacs |
| 55 |
(mw32script-make-pathext-regexp) |
| 56 |
(defun mew-w32-argument-editing-function (program args) |
| 57 |
(let ((default-process-argument-editing-function 'identity) |
| 58 |
(process-argument-editing-alist nil) |
| 59 |
prog sargs) |
| 60 |
(setq prog (mw32script-openp program)) |
| 61 |
(if (and (null prog) |
| 62 |
(setq prog (mew-which-exec program)) |
| 63 |
(setq sargs (mw32script-argument-editing-function (list prog)))) |
| 64 |
(cons (car sargs) (cons prog args)) |
| 65 |
(cons program args)))) |
| 66 |
(defadvice call-process |
| 67 |
(before mew-w32-call-process |
| 68 |
(program &optional infile buffer display &rest args) |
| 69 |
activate) |
| 70 |
(let ((sargs (mew-w32-argument-editing-function program args))) |
| 71 |
(setq program (car sargs) |
| 72 |
args (cdr sargs)))) |
| 73 |
(defadvice call-process-region |
| 74 |
(before mew-w32-call-process-region |
| 75 |
(start end program &optional infile buffer display &rest args) |
| 76 |
activate) |
| 77 |
(let ((sargs (mew-w32-argument-editing-function program args))) |
| 78 |
(setq program (car sargs) |
| 79 |
args (cdr sargs)))) |
| 80 |
(defadvice start-process |
| 81 |
(before mew-w32-start-process |
| 82 |
(name buffer program &rest program-args) |
| 83 |
activate) |
| 84 |
(let ((sargs (mew-w32-argument-editing-function program program-args))) |
| 85 |
(setq program (car sargs) |
| 86 |
program-args (cdr sargs)))))) |
| 87 |
|
| 88 |
;; printing |
| 89 |
(defun mew-w32-print-buffer () |
| 90 |
(let ((tempfile (mew-make-temp-name))) |
| 91 |
(mew-frwlet mew-cs-dummy mew-w32-cs-print |
| 92 |
(write-region (point-min) (point-max) tempfile nil nil)) |
| 93 |
(setq w32-start-process-show-window t) |
| 94 |
(cond |
| 95 |
((eq mew-w32-prog-print-arg nil) |
| 96 |
(call-process mew-w32-prog-print nil nil nil tempfile)) |
| 97 |
(t |
| 98 |
(call-process mew-w32-prog-print nil nil nil mew-w32-prog-print-arg tempfile))) |
| 99 |
(setq w32-start-process-show-window nil) |
| 100 |
(mew-delete-file tempfile))) |
| 101 |
|
| 102 |
|
| 103 |
;;; |
| 104 |
;;; MIME setting |
| 105 |
;;; |
| 106 |
|
| 107 |
(defvar mew-w32-exec "fiber.exe") |
| 108 |
(defvar mew-default-external-program mew-w32-exec) |
| 109 |
(setq mew-which-exec-suffixes (if (and (boundp 'exec-suffixes) |
| 110 |
exec-suffixes) |
| 111 |
exec-suffixes |
| 112 |
'(".exe" ".com" ".bat" ".cmd" ""))) |
| 113 |
|
| 114 |
(defvar mew-w32-prog-print "notepad.exe") |
| 115 |
(defvar mew-w32-prog-print-arg nil) |
| 116 |
(defvar mew-w32-cs-print nil) |
| 117 |
|
| 118 |
(defvar mew-prog-plain 'mew-mime-text/plain) |
| 119 |
(defvar mew-prog-html '(mew-mime-text/html mew-mime-text/html-ext)) |
| 120 |
(defvar mew-prog-xml '(mew-mime-text/xml mew-mime-text/xml-ext)) |
| 121 |
(defvar mew-prog-patch '(mew-mime-text/plain mew-mime-text/patch-ext)) |
| 122 |
(defvar mew-prog-enriched 'mew-mime-text/enriched) |
| 123 |
(defvar mew-prog-text 'mew-mime-text/plain) |
| 124 |
(defvar mew-prog-audio mew-w32-exec) |
| 125 |
(defvar mew-prog-audio2 mew-w32-exec) ;; dummy |
| 126 |
(defvar mew-prog-image '(mew-mime-image/* mew-mime-image/*-ext)) |
| 127 |
(defvar mew-prog-iges mew-w32-exec) |
| 128 |
(defvar mew-prog-vrml mew-w32-exec) |
| 129 |
(defvar mew-prog-mesh mew-w32-exec) |
| 130 |
(defvar mew-prog-video mew-w32-exec) |
| 131 |
(defvar mew-prog-rfc822 'mew-mime-message/rfc822) |
| 132 |
(defvar mew-prog-rfc822-headers 'mew-mime-text/rfc822-headers) |
| 133 |
(defvar mew-prog-external-body '(mew-mime-external-body mew-mime-external-body-ext)) |
| 134 |
(defvar mew-prog-delivery-status 'mew-mime-text/plain) |
| 135 |
(defvar mew-prog-postscript mew-w32-exec) |
| 136 |
(defvar mew-prog-pgp-keys '(mew-mime-pgp-keys mew-mime-pgp-keys-ext)) |
| 137 |
|
| 138 |
(defvar mew-prog-application/pdf "pdftotext") |
| 139 |
(defvar mew-prog-pdf-ext mew-w32-exec) |
| 140 |
(defvar mew-prog-pdf `(mew-mime-application/pdf ,mew-prog-pdf-ext)) |
| 141 |
|
| 142 |
(defvar mew-prog-application/rtf nil) |
| 143 |
|
| 144 |
(defvar mew-prog-xml2 '(mew-mime-application/xml |
| 145 |
mew-mime-application/xml-ext)) |
| 146 |
(defvar mew-prog-oasys mew-w32-exec) |
| 147 |
(defvar mew-prog-octet-stream mew-w32-exec) |
| 148 |
(defvar mew-prog-rtf mew-w32-exec) |
| 149 |
(defvar mew-prog-unzip mew-w32-exec) |
| 150 |
|
| 151 |
;;; |
| 152 |
;;; Text/Html, Application/Xml |
| 153 |
;;; |
| 154 |
|
| 155 |
(defvar mew-format-html "%s.htm") |
| 156 |
(defvar mew-format-xml "%s.xml") |
| 157 |
|
| 158 |
(defvar mew-prog-text/html |
| 159 |
(if (and (fboundp 'shr-render-region) |
| 160 |
(fboundp 'libxml-parse-html-region)) |
| 161 |
'shr-render-region |
| 162 |
'mew-mime-text/html-w3m)) ;; See w3m.el |
| 163 |
(defvar mew-prog-text/html-ext mew-w32-exec) |
| 164 |
|
| 165 |
(defvar mew-prog-text/xml |
| 166 |
(if (and (fboundp 'shr-render-region) |
| 167 |
(fboundp 'libxml-parse-html-region)) |
| 168 |
'shr-render-region |
| 169 |
'mew-mime-text/html-w3m)) ;; See w3m.el |
| 170 |
(defvar mew-prog-text/xml-ext mew-w32-exec) |
| 171 |
|
| 172 |
(defvar mew-prog-application/xml nil) |
| 173 |
(defvar mew-prog-application/xml-ext mew-w32-exec) |
| 174 |
|
| 175 |
|
| 176 |
;;; |
| 177 |
;;; Image |
| 178 |
;;; |
| 179 |
|
| 180 |
(defvar mew-prog-image/* 'mew-mime-image/*) |
| 181 |
(defvar mew-prog-image/*-ext mew-w32-exec) |
| 182 |
|
| 183 |
|
| 184 |
;;; |
| 185 |
;;; Office |
| 186 |
;;; |
| 187 |
|
| 188 |
(defvar mew-prog-ooffice mew-w32-exec) |
| 189 |
|
| 190 |
(defvar mew-prog-application/msword nil) |
| 191 |
(defvar mew-prog-msword mew-w32-exec) |
| 192 |
|
| 193 |
(defvar mew-prog-application/msexcel nil) |
| 194 |
(defvar mew-prog-msexcel mew-w32-exec) |
| 195 |
|
| 196 |
(defvar mew-prog-application/mspowerpoint nil) |
| 197 |
(defvar mew-prog-mspowerpoint mew-w32-exec) |
| 198 |
|
| 199 |
(defvar mew-prog-visio mew-w32-exec) |
| 200 |
|
| 201 |
|
| 202 |
;;; |
| 203 |
;;; Misc |
| 204 |
;;; |
| 205 |
|
| 206 |
(setq mew-cs-database-for-arg |
| 207 |
'((iso-2022-jp . shift_jis-unix) |
| 208 |
(iso-2022-kr . euc-kr-unix))) |
| 209 |
|
| 210 |
(setq mew-prog-grep-max-msgs 2000) ;; for external grep (pick & virtual) |
| 211 |
|
| 212 |
(defvar mew-dir-list-function 'mew-dir-list-without-link-count) |
| 213 |
|
| 214 |
(defun mew-draft-dnd-for-meadow (event) |
| 215 |
(interactive "e") |
| 216 |
(when (eq (posn-window (event-start event)) (selected-window)) |
| 217 |
(let ((files (car (cdr (cdr event)))) |
| 218 |
to) |
| 219 |
(if (stringp files) |
| 220 |
(setq files (list files))) |
| 221 |
(dolist (from files) |
| 222 |
(setq from (dos-to-unix-filename from)) |
| 223 |
(when (file-exists-p from) |
| 224 |
(setq to (file-name-nondirectory from)) |
| 225 |
(unless (mew-attach-p) |
| 226 |
(mew-draft-prepare-attachments)) |
| 227 |
(goto-char (point-max)) |
| 228 |
(forward-line -2) |
| 229 |
(mew-attach-next) |
| 230 |
(cond |
| 231 |
((file-directory-p from) |
| 232 |
(message "Directory cannot be attached")) |
| 233 |
(t |
| 234 |
(mew-attach-copy from to)))))))) |
| 235 |
|
| 236 |
;; |
| 237 |
|
| 238 |
(setq mew-delete-temp-file nil) |
| 239 |
|
| 240 |
(provide 'mew-win32) |
| 241 |
|
| 242 |
;;; Copyright Notice: |
| 243 |
|
| 244 |
;; Copyright (C) 1996-2015 Mew developing team. |
| 245 |
;; All rights reserved. |
| 246 |
|
| 247 |
;; Redistribution and use in source and binary forms, with or without |
| 248 |
;; modification, are permitted provided that the following conditions |
| 249 |
;; are met: |
| 250 |
;; |
| 251 |
;; 1. Redistributions of source code must retain the above copyright |
| 252 |
;; notice, this list of conditions and the following disclaimer. |
| 253 |
;; 2. Redistributions in binary form must reproduce the above copyright |
| 254 |
;; notice, this list of conditions and the following disclaimer in the |
| 255 |
;; documentation and/or other materials provided with the distribution. |
| 256 |
;; 3. Neither the name of the team nor the names of its contributors |
| 257 |
;; may be used to endorse or promote products derived from this software |
| 258 |
;; without specific prior written permission. |
| 259 |
;; |
| 260 |
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND |
| 261 |
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 262 |
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 263 |
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE |
| 264 |
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 265 |
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 266 |
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 267 |
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 268 |
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 269 |
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 270 |
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 271 |
|
| 272 |
;;; mew-win32.el ends here |