>>>> "Karl" == Karl M Hegbloom
<karlheg(a)inetarena.com> writes:
Karl> I'm trying to make `scheme.el' cause #! comments !# to work, akin to
Karl> the Common Lisp #| comments |#, but cannot get it to work. I'm very
Karl> frustrated trying; I've copied it straight from `lisp-mode.el':
Karl> (modify-syntax-entry ?# "' 58" scheme-mode-syntax-table)
Karl> (modify-syntax-entry ?\! "_ 67" scheme-mode-syntax-table)
Karl> ... but still when I visit a scheme file with:
Karl> #!/usr/bin/guile -s
Karl> !#
Karl> ... at the top, that section is not highlighted by font-lock as a
Karl> comment like it should.
Karl> I know this isn't really a very important thing to do... but it
Karl> should work, shouldn't it? What's wrong?
Here's the code I use, written for Gambit. It contains code stolen
from Barry's cc-mode.
(defun gambit-install-comment-syntax ()
"Configure #| ... |# comments."
;; XEmacs 19 and beyond use 8-bit modify-syntax-entry flags.
;; Emacs 19 uses a 1-bit flag. We will have to set up our
;; syntax tables differently to handle this.
;; Stolen from CC Mode.
(let ((table (copy-syntax-table))
entry)
(modify-syntax-entry ?a ". 12345678" table)
(cond
;; XEmacs 19, and beyond Emacs 19.34
((arrayp table)
(setq entry (aref table ?a))
;; In Emacs, table entries are cons cells
(if (consp entry) (setq entry (car entry))))
;; XEmacs 20
((fboundp 'get-char-table) (setq entry (get-char-table ?a table)))
;; before and including Emacs 19.34
((and (fboundp 'char-table-p)
(char-table-p table))
(setq entry (car (char-table-range table [?a]))))
;; incompatible
(t (error "Gambit mode is incompatible with this version of Emacs")))
(if (= (logand (lsh entry -16) 255) 255)
(progn
;; XEmacs 19 & 20
(modify-syntax-entry ?# "(#58" scheme-mode-syntax-table)
(modify-syntax-entry ?| ". 67" scheme-mode-syntax-table))
;; Emacs 19 & 20
(modify-syntax-entry ?# "(#14b" scheme-mode-syntax-table)
(modify-syntax-entry ?| ". 23b" scheme-mode-syntax-table))))
--
Cheers =8-} Chipsy
Friede, Völkerverständigung und überhaupt blabla