From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#39277: 26.3; Tcl font lock does not understand quoting Date: Tue, 27 Oct 2020 09:27:45 -0400 Message-ID: References: <20200125100009.33e3cpgmjszmpwzq@gentoo-zen2700x> <87lffs1zvw.fsf@cnu407c2zx.nsn-intra.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31364"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39277@debbugs.gnu.org, Hadrien Lacour To: mvar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 27 14:37:24 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXPAB-000833-CV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 14:37:23 +0100 Original-Received: from localhost ([::1]:49964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXPAA-0004ke-Bq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Oct 2020 09:37:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXP18-0002Gk-Kg for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 09:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kXP18-0007Zj-8u for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 09:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kXP18-000232-5U for bug-gnu-emacs@gnu.org; Tue, 27 Oct 2020 09:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Oct 2020 13:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39277 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 39277-submit@debbugs.gnu.org id=B39277.16038052757860 (code B ref 39277); Tue, 27 Oct 2020 13:28:02 +0000 Original-Received: (at 39277) by debbugs.gnu.org; 27 Oct 2020 13:27:55 +0000 Original-Received: from localhost ([127.0.0.1]:43310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXP11-00022h-DG for submit@debbugs.gnu.org; Tue, 27 Oct 2020 09:27:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kXP0z-00022U-2U for 39277@debbugs.gnu.org; Tue, 27 Oct 2020 09:27:53 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9495744072E; Tue, 27 Oct 2020 09:27:47 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3D27844071A; Tue, 27 Oct 2020 09:27:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1603805266; bh=Wd85WEaYjnz4HNIzQXzFmi9ojrZZKzN9gCfyYjvsJI4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=JGWolK8tWrKRiqPMG172YLY/rQt3kqokynkzwU9VWs8v3TKCoJC1IyAAwhGfqkG2e KPTeAHpwv7i5y+mIXevUH8L/QBtQ5DkO3ide5rxjako4Xba6/PTc+lhj85Dticlv3o ZlkJzdEGcqSBsjQOqocdHjNNgr2mhoNSFeerW6X5FrvYejJDLn8OGSC0ooJ9gCk9us xTXLuHgyuUTrxohCmjeDF1EA26mUycgJ8+/RIaG5udTYukOTXZmd5UXvYr1yi4fPj6 6lntjY6+OyTHy9NK+GoZfPKjd6riTByeYJRHlIUrZ2N8QjTXyRFVzc9qyZCLywOaIW 4edZUIC0AU8+Q== Original-Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0052C12016D; Tue, 27 Oct 2020 09:27:45 -0400 (EDT) In-Reply-To: <87lffs1zvw.fsf@cnu407c2zx.nsn-intra.net> (mvar's message of "Mon, 26 Oct 2020 22:44:03 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191739 Archived-At: >> 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