[Mew-Win32 00052] Re: mew-win32.el patch.

YAMAGUCHI, Shuhei yamagus at example.com
1997年 12月 25日 (木) 02:23:37 JST


やまぐち@ねっとらぴゅたの住人、です。

>>> In article <19971224145835Z.shuuic-k at example.com>,
>>>    Shuichi Kitaguchi <shuuic-k at example.com> writes:

  shuuic-k> 北口@奈良先端大%最近 Meadow しか使ってない です。

今日は久しぶりにMule for Win32をさわりました。 ^^;


  shuuic-k> あう、すいません、見落してました。

いえいえ、説明抜きで送った私にも問題ありますし。 ^^;


  >> んじゃ、ここにも送ってしまいましょう。 ^^;;;
  >> meadow-developでの最新と同じものです。
  >> #meadow-developに入っている方、ごめんなさい。
  shuuic-k> 
  shuuic-k> Meadow 関係のこともやりたかったかというのも、この ML を作った
  shuuic-k> 動機の一つだったりします。というわけでじゃんじゃんやって下さい(^^;

んじゃ、お言葉に甘えて…。
つい先程、Mule for Win32 MLにも送りましたが、mw32script.elの最新です。
Meadowだけでなく、Mule for Win32での確認もしたつもりです。

と…これだけじゃ能がないので、mw32script.el用mew-win32.elも付けます。
Mew以外でもwin32-scriptの機能を使っていて、Mule for Win32とMeadowの両
方を使い、しかも.emacsをまとめてしまいたい方向け、といったところでしょ
うか…。 ^^;;;

P.S.
mew-mailcryptは、忘れてください。 ^^;
FreeBSDのEmacs-20.2で使おうとしたら、coding-systemまわりで使えなかった。
MewのPGP呼び出しを流用して作れないかなぁ、と思案中です。
#あくまでも思案中なので、そんなに期待しないでくださいね。 ^^;;;
#他にもやりたい/やらなきゃいけない事があるので…。

でわでわ
-- 
yamagus at example.com / やまぐち@ねっとらぴゅたの住人
  yamagus at example.com / 山口 修平
PGP-Fingerprint: 25 0F 6F E1 57 AD 56 08  3A BC D0 9B 48 AF 31 7A
-------------- next part --------------
;;; mw32script.el
;;; Author: yamagus at example.com (YAMAGUCHI, Shuhei)
;;; Modified by H.Miyashita.
;;; Version 1.2 (Dec 24, 1997)
;;;
;;; [USAGE]
;;; Add the following in your .emacs:
;;;  (require 'mw32script)
;;;  (mw32script-init)

(defconst mw32script-version "Win32 Script version 1.2")
;; begin --- options
(defvar mw32script-argument-editing-alist
  '(("/sh$" . "sh.exe")
    ("/bash$" . "bash.exe")
    ("/perl$" . "perl.exe")
    ("/t?csh$" . "tcsh.exe"))
  "Association list of script interpreter.")

(defvar mw32script-pathext '(".com" ".exe" ".bat" ".cmd")
  "Extention list of executables.")

(defvar mw32script-resolve-script t
  "If non-nil, mw32script-argument-editing-function
resolve the script association.")

(defvar mw32script-resolve-extention (fboundp 'Meadow-version)
  "If non-nil, mw32script-argument-editing-function
resolve the filename association.
This only works with Meadow version Alpha-3.00 or later.")

(defvar mw32script-debug nil)
(defvar mw32script-recursive nil)
;; end --- options
(defconst mw32script-buffer-tmp " *mw32script*")
(defconst mw32script-debug-buffer " *mw32script*debug*")
(defvar mw32script-bufsiz 256)
(defvar mw32script-pathext-regexp nil)


(defun mw32script-make-pathext-regexp ()
  (setq mw32script-pathext-regexp
	(concat "\\("
		(mapconcat
		 (lambda (x) (regexp-quote x))
		 mw32script-pathext "\\|")
		"\\)$")))


(defun mw32script-openp (command-name)
  "Locate the full path name of external-command COMMAND-NAME."
  (interactive "sExternal-command: ")
  (catch 'tag
    (let (path)
      (if (file-name-absolute-p command-name)
	  (if (and (file-executable-p command-name)
		   (null (file-directory-p command-name)))
	      (throw 'tag command-name)
	    (mapcar
	     (lambda (suf)
	       (setq path (expand-file-name (concat command-name suf)))
	       (and (file-executable-p path)
		    (null (file-directory-p path))
		    (throw 'tag path)))
	     (if (null mw32script-pathext)
		 '("")
	       mw32script-pathext)))
	(mapcar
	 (lambda (dir)
	   (mapcar
	    (lambda (suf)
	      (setq path (expand-file-name (concat command-name suf) dir))
	      (and (file-executable-p path)
		   (null (file-directory-p path))
		   (throw 'tag path)))
	    (if (null mw32script-pathext)
		'("")
	      (append (list "") mw32script-pathext))))
	 exec-path))) nil))


(defun mw32script-resolve-script (path &optional directory)
  "Find executable path that interprets the script specified PATH.
Return value is a list of arguments, and car of the list is argv[0].
The optional argument DIRECTORY specify the default directory.
If the object executable is not found, return nil."
  (interactive "fScript: ")
  (setq path
	(expand-file-name
	 (if directory
	     (concat (file-name-as-directory directory) path)
	   path)))
  (let ((buf (generate-new-buffer mw32script-buffer-tmp))
	limit args)
    (unwind-protect
	(save-excursion
	  (set-buffer buf)
	  (condition-case nil
	      (progn
		(insert-file-contents path nil 0 mw32script-bufsiz)
		(goto-line 2)
		(setq limit (point))
		(goto-char 1)
		(if (re-search-forward
 		     "\\`#![ \t]*\\([^ \t\n]+\\)[ \t]*" limit t)
		    (while
			(progn
			  (setq args
				(nconc args
				       (list
					(buffer-substring (match-beginning 1)
							  (match-end 1)))))
			  (re-search-forward "\\([^ \t\n]+\\)[ \t]*"
					     limit t))))
		args)
	    (file-error nil)))
      (kill-buffer buf))))


(defun mw32script-resolve-extention (path &optional directory)
  "Find executable path that associated with filename specified PATH.
Return value is a list of arguments, and car of the list is argv[0].
The optional argument DIRECTORY specify the default directory.
If the object executable is not found, return 'notfound."
  (interactive "fFile: ")
  (setq path
	(expand-file-name
	 (if directory
	     (concat (file-name-as-directory directory) path)
	   path)))
  (let (executable)
    (condition-case nil
	(progn
	  (setq executable (w32-find-executable path))
	  (if (eq executable 'notfound)
	      executable
	    (list executable)))
      (error nil))))


(defun mw32script-debug-report (argument result)
  (save-excursion
    (set-buffer (get-buffer-create mw32script-debug-buffer))
    (goto-char (point-max))
    (if (consp result)
	(insert (format "%s --->\n(%s . %s)\n"
			argument (car result) (cdr result)))
      (insert (format "%s --->\n%s\n"
		      argument result)))
    result))


(defun mw32script-argument-editing-function (argument)
  "Resolv the script/filename association,
and do the argument editiong."
  (let ((argv0 (car argument)) sargs func ret)
    (if (string-match mw32script-pathext-regexp argv0)
	(setq ret
	      (funcall default-process-argument-editing-function argument))
      (and mw32script-resolve-extention
	   (setq sargs (mw32script-resolve-extention argv0)))
      (and mw32script-resolve-script
	   (or (not sargs) (eq sargs 'notfound))
	   (setq sargs (mw32script-resolve-script argv0)))
      (if (and sargs (not (eq sargs 'notfound)))
	  (progn
	    (setq argv0 (car sargs))
	    (catch 'tag
	      (mapcar
	       (lambda (pat)
		 (and (string-match (car pat) argv0)
		      (setq argv0 (mw32script-openp (cdr pat)))
		      (throw 'tag t)))
	       mw32script-argument-editing-alist))
	    (and (eq (setq func (find-process-argument-editing-function argv0))
		     (function mw32script-argument-editing-function))
		 (not mw32script-recursive)
		 (setq func default-process-argument-editing-function))
	    (setq ret
		  (funcall func (append (list argv0) (cdr sargs) argument)))
	    (if (not (consp ret))
		(setq ret (cons argv0 ret))))
	(setq ret
	      (funcall default-process-argument-editing-function argument))))
    (if mw32script-debug
	(mw32script-debug-report argument ret))
    ret))


(defun mw32script-execute-file (path &optional directory)
  (interactive "fFile: ")
  (setq path
	(expand-file-name
	 (if directory
	     (concat (file-name-as-directory directory) path)
	   path)))
  (let ((w32-start-process-show-window t))
    (call-process path nil 0 nil)))


(defun mw32script-init ()
  (interactive)
  (mw32script-make-pathext-regexp)
  (cond
   ((fboundp 'Meadow-version)
    (define-process-argument-editing
      ".*"
      'mw32script-argument-editing-function 'last))
   ((fboundp 'mule-for-win32-version)
    (define-process-argument-editing
      "/[^./]+$"
      'mw32script-argument-editing-function 'last))))

(provide 'mw32script)
;;; --- end of mw32script
-------------- next part --------------
;;; mew-win32.el --- Settings for Mew on Win32

;; Author:  Shuichi Kitaguchi <kit at example.com>
;; Created: Dec 05, 1997
;; Revised: Dec 24, 1997

;;; Code:

(defconst mew-win32-version "mew-win32.el 0.15.1")

;; programs.
(setq mew-prog-mime-encode "mewencode.exe")
(setq mew-prog-mime-decode "mewdecode.exe")
(setq mew-prog-tar         "tar.exe")
(setq mew-prog-compress    "compress.exe")
(setq mew-prog-gzip        "gzip.exe")
(setq mew-prog-shell       shell-file-name)

(setq mew-prog-pgp         "pgp.exe")

(setq mew-prog-utime       "utime.exe")
(setq mew-touch-folder-p   t)
(setq mew-ext-prog-url     "fiber.exe")

(setq mew-prog-uncompface  "uncompface.exe")


;; browse-url.
(defun browse-url-client (url)
  (interactive (browse-url-interactive-arg "URL: "))
  (x-set-selection 'PRIMARY url )
  (start-process "WWW Browser" nil
		 mew-ext-prog-url url))
(setq browse-url-browser-function 'browse-url-client)


;; Emacs version dependent variables.
(cond
 ((string-match "XEmacs\\|Lucid" emacs-version)	; XEmacs?
  (setq mew-prog-shell-arg  shell-command-switch)
  
  (make-coding-system 'no-conv 'no-conversion "Do no conversion")
  (put 'no-conv 'eol-type 'crlf)
  (setq mew-cs-noconv-eol 'no-conv-dos))

 ((eq 20 emacs-major-version)		; Meadow
  (setq mew-prog-shell-arg  shell-command-switch)
  
  (make-coding-system 'no-conv 0 ?T "Do no conversion")
  (put 'no-conv 'eol-type 1)
  (setq mew-cs-noconv-eol 'no-conv-dos)
  
  (require 'mw32script)
  (mw32script-init))
 (t					; Mule for Win32
  (setq mew-prog-shell-arg  shell-command-option)
  
  (make-coding-system
   '*crlf2lf* 4
   ?= "No conversion." nil
   '([1 23 47 346 13 18 250 10 18 1881 5 4421 19 10
	47 772 5892 49 58 0 0 14 772 49 22] .
	[1 4 14 775 22]))
  (setq mew-cs-noconv-eol *crlf2lf*)
  
  (require 'mw32script)
  (mw32script-init)))


(defvar mew-prog-plain '(mew-mime-text/plain () nil))
(defvar mew-prog-text '(mew-mime-text/plain () nil))
(defvar mew-prog-audio '("fiber.exe" () t))
(defvar mew-prog-gif '("fiber.exe" () t))
(defvar mew-prog-jpeg '("fiber.exe" () t))
(defvar mew-prog-xwd '("fiber.exe" () t))
(defvar mew-prog-xbm '("fiber.exe" () t))
(defvar mew-prog-bmp '("fiber.exe" () t))
(defvar mew-prog-image '("fiber.exe" () t))
(defvar mew-prog-mpeg '("fiber.exe" () t))
(defvar mew-prog-rfc822 '(mew-mime-message/rfc822 () nil))
(defvar mew-prog-external-body '(mew-mime-external-body () nil))
(defvar mew-prog-delivery-status '(mew-mime-text/plain () nil))
(defvar mew-prog-postscript '("fiber.exe" () t))
(defvar mew-prog-pgp-keys '(mew-mime-pgp-keys () nil))
(defvar mew-prog-octet-stream '("fiber.exe" () t))

(provide 'mew-win32)

;;; Copyright Notice:

;; Copyright (C) 1996, 1997 Mew developing team.
;; All rights reserved.

;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;; 
;; 1. Redistributions of source code must retain the above copyright
;;    notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above copyright
;;    notice, this list of conditions and the following disclaimer in the
;;    documentation and/or other materials provided with the distribution.
;; 3. All advertising materials mentioning features or use of this software
;;    must display the following acknowledgement:
;;       This product includes software developed by 
;;       Mew developing team and its contributors.
;; 4. Neither the name of the team nor the names of its contributors
;;    may be used to endorse or promote products derived from this software
;;    without specific prior written permission.
;; 
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
;; PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

;;; mew-win32.el ends here


Mew-win32 メーリングリストの案内