GNU bug report logs - #39277
26.3; Tcl font lock does not understand quoting

Previous Next

Package: emacs;

Reported by: Hadrien Lacour <hadrien.lacour <at> posteo.net>

Date: Sat, 25 Jan 2020 10:01:02 UTC

Severity: normal

Tags: fixed

Found in version 26.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #30 received at 39277 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mvar <mvar.40k <at> gmail.com>
Cc: 39277 <at> debbugs.gnu.org, Hadrien Lacour <hadrien.lacour <at> posteo.net>
Subject: Re: bug#39277: 26.3; Tcl font lock does not understand quoting
Date: Tue, 27 Oct 2020 09:27:45 -0400
>> Hello, tcl-mode's font lock (highlighting) chokes on this simple case:
>>     puts {"hello}
>> where it considers the double quote inside the curly braces as a
>> "quoting" character.
>> I have confirmed it works with `emacs -Q`.
> there's some generic(?) syntactic font lock getting triggered once the
> doublequote character is found, that expects a closing doublequote - until then
> everything is locked as a string. Is this what this bug is about (it was not
> 100% clear to me from your initial report) ? i'm attaching a patch that works
> around this behavior but i don't know if it is the proper way to deal with the
> problem (it certainly doesn't look pretty).

It's been too long since I last had to deal with Tcl so I can't remember
the rules.  The patch you submitted is most likely not "correct" in the
sense that it still leaves many cases that are mishandled.

Could someone remind me how " and {..} interact in Tcl?

E.g.

    proc foo1 () {
       puts "hello"
    }

prints "hello" (without the quotes)?
And

    proc foo2 () {
       puts {"hello}
    }

prints "hello (with the quote)?
And what about

    proc foo3 () {
       puts "hello}"
    }

    proc foo4 () {
       puts "hello\}"
    }

    proc foo5 () {
       puts "hello
    }

> The idea is to insert an additional
> rule in tcl-syntax-propertize-function that will match the tcl-builtin-list

I'm thinking that maybe a better option is to catch all " in
tcl-syntax-propertize-function and for every one of them see if they're
"closing" a string and if not, check whether they're closed by a } before
a matching " and if so mark them as "not opening a string".

> +         '("{\\([^}]+\\)}" 1 font-lock-string-face)

Won't this catch cases not usually considered as strings, like

    proc foo5 () {
        return 6
    }

?

        Stefan





This bug report was last modified 4 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.