emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More font-lock keywords for tcl.el


From: Stefan Monnier
Subject: Re: More font-lock keywords for tcl.el
Date: Wed, 30 Mar 2005 17:18:56 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> Just skimming through it, I notice "namespace".  Is it really a
>> builtin? I would've expected it to be a keyword.

> It's a command, if that's what you're asking. (I got this list from
> Some-Frighteningly-Thick-Tcl-Book.)

Well, your patch distinguishes between tcl-keyword-list and
tcl-builtin-list, so is `namespace' more like `append' or more like `if'?
To me it feels more like an `if', in that it seems to be part of the syntax
rather than one of a set of builtin functions.  But I honestly have no idea
what was your intention behind the separation keyword-vs-builtin.

>>> +          (list (concat "\\(\\s-\\|^\\|\\[\\)"
>>> +                  (regexp-opt tcl-builtin-list t)
>>> +                  "\\(\\s-\\|$\\|\\]\\)")
>> 
>> How 'bout (concat "\\_<" (regexp-opt tcl-builtin-list t) "\\_>") ?

> OK. I used the format I did because it's the same as the existing
> stuff in tcl.el.

I know, but I think the other one should be changed as well.  Except that in
neither case do I know whether my suggestion is really the right idea.
Maybe it breaks some hilighting, so please check it.

>>> +          '("\\\\$" 0 font-lock-warning-face) ; escaped EOL
>> Why warning?  Is it dangerous?  I don't think so.
> Personally, I like it to stand out (that's no argument, of course!).

Well, you might know better than I.  I just seem to remember using such
escaped-newlines fairly often in my Tcl code.  But maybe I was just a lousy
Tcl coder.

> I think I was trying to be consistent with sh-script.el.

I'm not sure sh-script's use of warning-face is such a hot idea either.

> There, escaped EOLs used to be highlighted in string-face. But that
> confused sh-get-indent-info, so I changed it to warning-face.

Yes, I remember that.

>> Also the regexp matched more than escaped EOL, it also matches an
>> escaped backslash at the end of the line.

> What's a regexp for "/ at the end of a line, not preceded by an odd
> number of other /"?

> I tried this monstrosity:

> "\\(?:[^\\\\]\\|\\(?:\\\\\\\\\\)+\\)\\(\\\\\\)$"

> but it also matches \\\\ (I don't see why).

Because it matches just the last 3 backslashes.
You have to use something like

  "\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\)\\(\\\\\\)$"

see for example comment-start-skip in emacs-lisp-mode.  You can also
check for escaped backslashes in the "face" part rather than in the "regexp"
part of the font-lock-keyword.

> But sh-script should at least be corrected, I guess.

Probably; patches welcome,


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]