Skip to content

Instantly share code, notes, and snippets.

@kosh04
Created April 19, 2009 10:34
Show Gist options
  • Save kosh04/98017 to your computer and use it in GitHub Desktop.
Save kosh04/98017 to your computer and use it in GitHub Desktop.
;; コンパイルしないと遅いので注意
;; 需要はなさそうだが、
;; *buffer-package* のシンボルのみ色付けにするとか
;; パッケージ::シンボル名 にも対応するとか
;; キーワードファイルの書き方 - refwiki
;; http://xyzzy.s53.xrea.com/reference/wiki.cgi?p=%A5%AD%A1%BC%A5%EF%A1%BC%A5%C9%A5%D5%A5%A1%A5%A4%A5%EB%A4%CE%BD%F1%A4%AD%CA%FD
(defun reload-keyword-file+ ()
"LISP限定追加の色付け."
(interactive "p")
(unless (and (member buffer-mode '(lisp-mode lisp-interaction-mode))
(boundp 'keyword-hash-table)
keyword-hash-table)
(return-from reload-keyword-file+))
(let (fsyms vsyms)
(do-all-symbols (sym)
(cond ((and (fboundp sym)
(null (gethash (symbol-name sym) ed::*lisp-keyword-hash-table*)))
(push sym fsyms))
((and (boundp sym)
(null (gethash (symbol-name sym) ed::*lisp-keyword-hash-table*))
(null (keywordp sym))
(null (member sym lambda-list-keywords)))
(push sym vsyms))))
(copy-file (merge-pathnames "lisp" (etc-path))
#1=(merge-pathnames "lisp++" (etc-path))
:if-exists :overwrite)
(with-open-file (stream #1# :direction :output :if-exists :append)
;; Function
(format stream ";**e0~%")
(format stream "~{~A~%~}" fsyms)
;; Variable
(format stream ";**50~%")
(format stream "~{~A~%~}" vsyms))
(setq keyword-hash-table (load-keyword-file "lisp++"))
(refresh-screen t)))
(or (compiled-function-p #'reload-keyword-file+)
(compile 'reload-keyword-file+))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment