Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

font-lock & regexps

0 views
Skip to first unread message

Kai.Gro...@cs.uni-dortmund.de

unread,
Mar 25, 1999, 3:00:00 AM3/25/99
to
Sam Steingold <s...@goems.com> writes:

> 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.

Kai.Gro...@cs.uni-dortmund.de

unread,
Mar 25, 1999, 3:00:00 AM3/25/99
to
Sam Steingold <s...@goems.com> writes:

> 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.

Andreas Schwab

unread,
Mar 26, 1999, 3:00:00 AM3/26/99
to
Sam Steingold <s...@goems.com> writes:

|> 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

Dave Love

unread,
Mar 28, 1999, 3:00:00 AM3/28/99
to
>>>>> "KG" == Kai Grossjohann <Kai.Gro...@CS.Uni-Dortmund.DE> writes:

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.]

0 new messages