common lispを使ってみる。

xyzzyclispは大体同じなのだけど、違いを見極めるために、keywordを取得しておく。
xyzzy用に書いたものが、ほとんどそのまま使えるので簡単だった。
互換なんだから当たり前といえば当たり前だけど、ちょっと感動。

(defun make-lisp-keyword (file)
  (let (macros functions variables l)
    (do-all-symbols (sym)
      (cond
       ((macro-function sym) (push sym macros))
       ((fboundp sym) (push sym functions))
       ((boundp sym) (push sym variables))))
    (with-open-file (with file :direction :output
			  :if-exists :overwrite :if-does-not-exist :create)
		    (map nil #'(lambda (lst color)
				 (push (format nil ";~A" color) l)
				 (dolist (key lst)
				   (push (format nil "~(~A~)" key) l)))
			 (list variables macros functions)
			 '("*2" "*0" ""))
		    (dolist (x (reverse (delete-duplicates l :test #'equal)))
		      (format with "~A~%" x)))))

なぜか大文字で出てくるので、小文字にしたり、重複が多そうだったので削ってみたりしたけど、このくらいなら差がない。string-matchはないけどね。
出来たファイルをetcに放り込んでおこう。