辞書引いた結果をファイルに残す

コードを書いてみました。
重複してるものは消すとか色々拡張できる予感。久々にxyzzylisp書いた。結構時間かかってしまった。openの挙動が微妙だった。Helpを見るとIF-DOES-NOT-EXISTと書いてあったんだけど小文字にしないと動かないっぽい。何故?


(defun lookup-e2j-dictionary-selection-and-save-history ()
(interactive)
(let ((dic-buf "*dictionary*")
str before-buf fp)
(setq before-buf (selected-buffer))
(lookup-e2j-dictionary-selection)
(switch-to-buffer dic-buf)
(setq str (buffer-substring (point-min)
(point-max)))
(setq fp (open "~/lookup-dictionary-history"
:direction :output
:if-exists :append
:if-does-not-exist :create
))
(princ str fp)
(close fp)
(switch-to-buffer before-buf)))
(global-set-key '(#\C-c #\e)
'lookup-e2j-dictionary-selection-and-save-history)