二つほど公の場(?)に出した。[mew-dist: 23093], [mew-dist: 23094]
(define-process-argument-editing "/kill\.exe$"
(lambda (x) (general-process-argument-editing-function x nil t)))
(defun get-windows-pid (prog)
(let ((ps "c:/Program Files/Support Tools/tlist.exe")
(case-fold-search t))
(with-temp-buffer
(call-process ps nil (current-buffer) nil)
(goto-char (point-min))
(when (re-search-forward (format "^ *\\([0-9]+\\) +%s " prog) nil t)
(match-string 1)))))
(defun hotsync-kill (&optional nomsg)
"HotSync を殺す"
(interactive)
(let ((kill "c:/Program Files/Support Tools/kill.exe")
(pid (get-windows-pid "hotsync.exe")))
(if (null pid)
(or nomsg (message "HotSync は動いていません"))
(call-process kill nil nil nil pid)
(or nomsg (message "HotSync を抹殺しました"))
(sit-for 1))))
(defun hotsync-enable (&optional nomsg)
"HotSync を起動する"
(interactive)
(let ((hotsync "c:/usr/palm/Hotsync.exe")
(pid (get-windows-pid "hotsync.exe"))
(buf " *HotSync*")
(process-connection-type nil)
proc)
(if pid
(or nomsg (message "HotSync はすでに動いています"))
(save-excursion
(get-buffer-create buf)
(set-buffer buf)
(setq proc (start-process "*HotSync*" (current-buffer) hotsync))
(process-kill-without-query proc)
(or nomsg (message "HotSync を起動しました"))))))