> The problem is that:
>
> (string-match "\\<:\\sw+\\>" ":keyword")
> ==> nil
What syntax does : have? If it isn't "w", maybe there can never be a
beginning of a word to the left of ":".
kai
--
I like _ b_ o_ t_ h kinds of music.
> C-h s tells you that in both emacs-lisp-mode and scheme-mode, ":" is
> "_", i.e., symbol. of course this explains why I am getting nil there,
> but it doesn't answer the original question which you edited out: how
> come the fontification works then?
I was assuming that the syntax of ":" was different in scheme mode
then when you evaled the expression you gave.
Sorry.
|> I am somewhat baffled: in scheme mode keywords like ":keyword" are
|> highlighted with `font-lock-builtin-face' due, apparently, to the
|> following element of scheme-font-lock-keywords-2:
|>
|> ("\\<:\\sw+\\>" . font-lock-builtin-face)
|>
|> The problem is that:
|>
|> (string-match "\\<:\\sw+\\>" ":keyword")
|> ==> nil
|>
|> what is going on?
Note this part of scheme.el:
(setq font-lock-defaults
'((scheme-font-lock-keywords
scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
nil t (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun
^^^^^^^^^^^^^^^^^^^^^^^^^^^
(font-lock-mark-block-function . mark-defun))))
From the doc string of font-lock-defaults (SYNTAX-ALIST is the fourth
element):
If SYNTAX-ALIST is non-nil, it should be a list of cons pairs of the form
\(CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for
keyword and syntactic fontification (see `modify-syntax-entry').
--
Andreas Schwab "And now for something
sch...@issan.cs.uni-dortmund.de completely different"
sch...@gnu.org
KG> I was assuming that the syntax of ":" was different in scheme mode
KG> then when you evaled the expression you gave.
And you were right in the context in which font-lock runs; see
`font-lock-defaults'. [Similarly with `imenu-syntax-alist' which
originated with Scheme mode IIRC.]