keyconf.l (2)

[xyzzy][Lisp] keyconf.l へのトラックバックでバグの指摘を受けた。

get-command-table (name)

name に関連づけられた hash-table を *command-tables-table* から取得(まだ無かったら作る)して返す、という関数。なんだけどせっかく作った hash-table を *command-tables-table* に保存してないので、毎回新たに hash-table を作ってしまう

keyconf.l で興味深い現象が起きていた - 日々ごちゃごちゃと考える

うへぇ。なんか汎変数を勝手に勘違いしてた。

(defun get-command-table (name)
  (macrolet ((place () `(gethash name *command-tables-table*)))
    (or (place)
	(setf (place) (make-hash-table)))))

トラバ先も参考ににさせていただいて、こんな感じに直した。これで大丈夫だろう。
こういうときのplaceには、symbol-macroletがあればそれを使うのがいいんだろうねぇ。