all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: More font-lock keywords for tcl.el
Date: Wed, 30 Mar 2005 17:18:56 -0500	[thread overview]
Message-ID: <jwv7jjokezu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8vsm2drqcy.fsf@xpc14.ast.cam.ac.uk> (Glenn Morris's message of "Wed, 30 Mar 2005 18:33:01 +0100")

>> 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	other threads:[~2005-03-30 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-30 15:24 More font-lock keywords for tcl.el Glenn Morris
2005-03-30 16:20 ` Stefan Monnier
2005-03-30 17:33   ` Glenn Morris
2005-03-30 22:18     ` Stefan Monnier [this message]
2005-03-31 19:32       ` Glenn Morris
2005-03-31 20:36         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7jjokezu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.