From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: mvar Newsgroups: gmane.emacs.bugs Subject: bug#39277: 26.3; Tcl font lock does not understand quoting Date: Mon, 26 Oct 2020 22:44:03 +0200 Message-ID: <87lffs1zvw.fsf@cnu407c2zx.nsn-intra.net> References: <20200125100009.33e3cpgmjszmpwzq@gentoo-zen2700x> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13565"; 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 To: Hadrien Lacour Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 26 22:05:12 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 1kX9g0-0003PX-EE for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Oct 2020 22:05:12 +0100 Original-Received: from localhost ([::1]:49288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kX9fz-0002kD-Fm for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 26 Oct 2020 17:05:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kX9fq-0002iP-39 for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2020 17:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kX9fp-0005cs-Qp for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2020 17:05:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kX9fp-0008IW-MH for bug-gnu-emacs@gnu.org; Mon, 26 Oct 2020 17:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: mvar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Oct 2020 21:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39277 X-GNU-PR-Package: emacs Original-Received: via spool by 39277-submit@debbugs.gnu.org id=B39277.160374624431824 (code B ref 39277); Mon, 26 Oct 2020 21:05:01 +0000 Original-Received: (at 39277) by debbugs.gnu.org; 26 Oct 2020 21:04:04 +0000 Original-Received: from localhost ([127.0.0.1]:41640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kX9et-0008HD-Kw for submit@debbugs.gnu.org; Mon, 26 Oct 2020 17:04:04 -0400 Original-Received: from mail-ed1-f46.google.com ([209.85.208.46]:33256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kX9Lh-0005dx-UE for 39277@debbugs.gnu.org; Mon, 26 Oct 2020 16:44:14 -0400 Original-Received: by mail-ed1-f46.google.com with SMTP id w23so11002238edl.0 for <39277@debbugs.gnu.org>; Mon, 26 Oct 2020 13:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=f8vCjxytru6tUey8UO5HaSfYNZzfPfq4PRJn3+clIUY=; b=O1s/71etk/bvaldO1htiM6IjNuMvlv9hr8WxOZTqNNOp9A4JNlWVhU1dbs6kkE9kyw 991AVShrlRJQ7P41mM6tNN6onK3vZ7njycaWoN1kdeAES1SU7R6fYXyvQCW5+6a8bPT0 puYQQ4kpuSck6OwExzCUykReZ09ew2CSnqOcE7mDdnQmdyvqRB2KVSPdl3eHntMOwbM9 8aihcmgGToxbI8DLZkxUQOJ2BSp6hr5Api6PiITfZlsLtkwocRlFKHZxrONcIabl3RRT m1v4RGPxz78DjPs0e1f5y93a/L+D3sST9nDJoLKWLsWwJBT2FhwyqetcUpo0iZHqi9Fq aBYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=f8vCjxytru6tUey8UO5HaSfYNZzfPfq4PRJn3+clIUY=; b=Qib7Ntl/xalmccWD9+XFQ59jMKZLv+NDQsmkVhZAgOlQyfWEZwIASZdqO7yenGtNdF YD7zezAQ2w4ZzVUC2ZmHpQS2Ux7O1TIxRxHyqVEKZnMI79j54o1z11bBIkhqKUg1A97O KuhCsA7zH2C6h8D252p4IQcXeze0h3IeWLNVvHfEBd1QZg25JRL2MYy4V9NbmhUhvHd7 5u2vR5Y/EPHJW5nVr+sQLq/vCaoJ9q6jLoD3MjKhgNW8mVPS839d2MPKzNsH6oY/x0wH srZSXMghKMVKotnEIuCuqV+OjwwU8JIBXDk0x9zrrr91YE2i+zsJwUBY2hu8WjT4c3w1 71Ug== X-Gm-Message-State: AOAM530Ob0h5p3iahLFMjll2v7tyz8yKU8aC5+mwJ+4umq1VKDYuoJqf 42VdDXJmii/y9yxyNLbqSJNc6q7gQcQ= X-Google-Smtp-Source: ABdhPJyYADYXE8n4e/0UQe7oFSIZAG8nR++z6ja1SkALWgASIirU/KlRuzZwIGmT8eVw4R8ZXWRrgQ== X-Received: by 2002:a05:6402:359:: with SMTP id r25mr17837606edw.308.1603745047647; Mon, 26 Oct 2020 13:44:07 -0700 (PDT) Original-Received: from cnu407c2zx.nsn-intra.net ([2a02:2149:8812:6200:cfbb:6c67:9fe9:bcf7]) by smtp.gmail.com with ESMTPSA id l12sm5726419edj.75.2020.10.26.13.44.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2020 13:44:06 -0700 (PDT) X-Google-Original-From: mvar In-Reply-To: <20200125100009.33e3cpgmjszmpwzq@gentoo-zen2700x> (Hadrien Lacour's message of "Sat, 25 Jan 2020 11:00:09 +0100") X-Mailman-Approved-At: Mon, 26 Oct 2020 17:04:01 -0400 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:191661 Archived-At: --=-=-= Content-Type: text/plain Hadrien Lacour writes: > 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`. hi Hadrien, 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). The idea is to insert an additional rule in tcl-syntax-propertize-function that will match the tcl-builtin-list keywords ('puts' is in there among others) plus the brackets that follow, so that if a doublequote is found in-between the brackets then there won't be any automatic string locking that would mess up the closing brackets and everything else (until another doublequote was found). Then in tcl-set-font-keywords a new rule will match the brackets and any characters inside will be locked as a string (including the single quote). --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=tcl.patch Content-Description: tcl.el patch diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 33aad2d39f..5dd02c1367 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -410,7 +410,8 @@ tcl-font-lock-keywords (defconst tcl-syntax-propertize-function (syntax-propertize-rules ;; Mark the few `#' that are not comment-markers. - ("[^;[{ \t\n][ \t]*\\(#\\)" (1 "."))) + ("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")) + ((concat "\\_<" (regexp-opt tcl-builtin-list t) "\\_>" "\s*{\\([^}].*\\)}") (2 "_"))) "Syntactic keywords for `tcl-mode'.") ;; FIXME need some way to recognize variables because array refs look @@ -506,6 +507,7 @@ tcl-set-font-lock-keywords ;; number of "namespace::" qualifiers. A leading "::" refers ;; to the global namespace. '("\\${\\([^}]+\\)}" 1 font-lock-variable-name-face) + '("{\\([^}]+\\)}" 1 font-lock-string-face) '("\\$\\(\\(?:::\\)?\\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)" 1 font-lock-variable-name-face) '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+{\\([^}]+\\)}" --=-=-=--