私はこれがどのように機能するのか見当がつかないので、コードを読んでそれを理解する方法を文書化するだけです。
openwith.elの重要なコードは、次の場所でstart-processを呼び出すことです。
(dolist (oa openwith-associations)
(let (match)
(save-match-data
(setq match (string-match (car oa) (car args))))
(when match
(let ((params (mapcar (lambda (x)
(if (eq x 'file)
(car args)
(format "%s" x))) (nth 2 oa))))
(apply #'start-process "openwith-process" nil
(cadr oa) params))
(kill-buffer nil)
(throw 'openwith-done t))))
あなたの場合、oaは次の構造になり、cadrは「xfig」です。
(cadr '("\.fig\'" "xfig" (file))) ;; expands to => xfig
これは、start-processの定義とドキュメントです。
関数:start-process name buffer-or-name program&rest args
http://www.gnu.org/software/emacs/elisp/html_node/Asynchronous-Processes.html
args, are strings that specify command line arguments for the program.
例:
(start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
次に、paramsがどのように構築されるかを理解する必要があります。あなたの例では、mapcarの引数は次のとおりです。
(nth 2 '("\.fig\'" "xfig" (file))) ;=> (file)
ちなみに、このような行をemacsのスクラッチバッファーに書き込んで、CMxで実行することができます。
(car args)は、openwith-associationに指定するパラメーターを参照します。(n番目の2 oa)での'ファイルの出現がそれに置き換えられることに注意してください。今のところ、これを「here.txt」に置き換えます。
(mapcar (lambda (x)
(if (eq x 'file)
"here.txt"
(format "%s" x))) (nth 2 '("\.fig\'" "xfig" (file)))) ;=> ("here.txt")
さて、引数をどのように構成するかがわかりました。
(mapcar (lambda (x)
(if (eq x 'file)
"here.txt"
(format "%s" x)))
(nth 2 '("\.fig\'" "xfig"
("-specialtext" "-latexfont" "-startlatexFont" "default" file))))
; => ("-specialtext" "-latexfont" "-startlatexFont" "default" "here.txt")
これを試して:
(setq openwith-associations
'(("\\.fig\\'" "xfig" ("-specialtext" "-latexfont" "-startlatexFont" "default" file))))
パラメータのリストでは、各単語を1つの文字列として指定する必要があります。