From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maciej Kalandyk Newsgroups: gmane.emacs.bugs Subject: bug#67703: Fix python-ts-mode syntax higlighting as to account for default arguments Date: Fri, 08 Dec 2023 05:36:52 +0100 Message-ID: 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="22938"; mail-complaints-to="usenet@ciao.gmane.io" To: 67703@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 08 05:43:04 2023 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 1rBShc-0005on-KC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Dec 2023 05:43:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBShP-0005sk-Oh; Thu, 07 Dec 2023 23:42:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBShO-0005sb-7I for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 23:42:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBShN-0006Ay-VM for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 23:42:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBShZ-0003L6-Ur for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 23:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Maciej Kalandyk Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Dec 2023 04:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67703 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170201054812767 (code B ref -1); Fri, 08 Dec 2023 04:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Dec 2023 04:42:28 +0000 Original-Received: from localhost ([127.0.0.1]:43585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBSh2-0003Jq-5I for submit@debbugs.gnu.org; Thu, 07 Dec 2023 23:42:28 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:42700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBSgw-0003Ja-Pn for submit@debbugs.gnu.org; Thu, 07 Dec 2023 23:42:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBSge-0005qA-OF for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 23:42:04 -0500 Original-Received: from mail-vi1eur05olkn20824.outbound.protection.outlook.com ([2a01:111:f400:7d00::824] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBSgb-0005zq-VR for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 23:42:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nbFU8osGsSZ2c+c5Cvrr2CUxJ/bE7l9GsdMGncjt2IS4MSzyLYmjhGZiJvba4c9rLKPsf6dVMmiJg1LwVtUi9hd4QH0Ii17c+WQFR/b9b7nHVJKBg9AvSamEvzwHKXn5JYmMFdTUub2NOm+eCtomHvyF9OJHUb9jEiGliaxt7cAaCY00HQyEcHRdoqEn7xWySDvi9cU92XbNEPgOY5noE1JdLq9iM/7jOs39D8XTSPF7tgBCWuT7wyEm6QA+5UFd34y+RvND+bWQ0cPEUh8rOjMSAuJpi5Zr3Tlrb5sxJqpVte7sG4/nJA02fRMTEXBC3zrbM1QjvqNMCcjfZpSxaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1FU8KGUim0vtgB5oWQ/tJZ7f6NifI4CrSvWiq0j6xZ4=; b=NQC3cTzKa5kcHNRLm3+bLLb8A+zGgQNHIgM8hUiDC0ae87tkulby1CEARvw6DciB2+49LIcQz5nBWpfJE0arQIxmp4Euhr5XoGGr5UNp5i3dN8KcXvQTPNGIm9bSOh14JmAxDY8uDykb3NQmC/krvaeBgExfvvD7wkjDXsew7l0iy4uIVOT47dkvRdKN2qnytVT7lJw6umQ6smmOy6g7+ya6K6+1Bgj8vF9vGEchPq+4qXHRvw9unpa3hJVILdNZUImi3eK+lR3c3/1sdYzeWLegGf1jhLIMoCD1bBBK99gpeGslOKrkiYFRDZErpTMg4JvSTx2H84km1ILEZb3frw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1FU8KGUim0vtgB5oWQ/tJZ7f6NifI4CrSvWiq0j6xZ4=; b=XSQZun4SlBWqoayt8AZmd81CJy7wrmoFUiXzkoBEGZ2/Vtlxc5/DyZf3IkF+SETBPZv1CIpicXl/cW61qDYyQGHFqhplztB4AE0h44UF2uA2I7DpPRc+tlS48aeZpuV+OBgiBUMHMeVpohXYeJ9vd0OdMoq6YUeqZmeHWlKCNPLTRqKbAVguHhpdRts87sGjN08UB4ciFuqHPSJgfUSE604B1j6wfdqyD6H+6CzOsywd7mdRZXZO25u8Z8vJ7oPC+3VrpHA+ieJkHpcFsF7JZxtxxC921xKwR0Yi3bTEvS7v2ZEwHnqXwF7EdnwsD+lhNxHTj4HTc6JSHNXKrKtvcA== Original-Received: from AM0PR10MB3586.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:157::23) by PAXPR10MB5160.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:288::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 04:36:56 +0000 Original-Received: from AM0PR10MB3586.EURPRD10.PROD.OUTLOOK.COM ([fe80::48b1:c028:349d:85b2]) by AM0PR10MB3586.EURPRD10.PROD.OUTLOOK.COM ([fe80::48b1:c028:349d:85b2%4]) with mapi id 15.20.7068.028; Fri, 8 Dec 2023 04:36:56 +0000 X-TMN: [FyAd+DjTrPfFzcVFxSFikVrJ5ktOJZh2] X-ClientProxiedBy: WA1P291CA0022.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:19::29) To AM0PR10MB3586.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:157::23) X-Microsoft-Original-Message-ID: <87bkb1paxn.fsf@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR10MB3586:EE_|PAXPR10MB5160:EE_ X-MS-Office365-Filtering-Correlation-Id: d4c87fac-6566-4efe-e519-08dbf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clhxwH6ThaMcgkOcf9An8P9EANaV+x5axxvkahgPLPCw45dkSs7Q7nRqkI6mNSXwu58tOMeFhmti0PstuUzcDtJJ/FQDu8JBsiAtLDT+wbQKs2x8dJqbeu3MuF8gYVDHWuJ92R+5dWqWmLaWu6MrQ61DJzXQ6qHui6ExztPFxX45x0sHNWVGZw6rTBRLUjy+jmOxksukQtoBtL23EFwUi3Yy2YcGFz52nNTpVL4XgCWj1Ass9G3uu+g8w+vvs1iPQRLBTggcCAL7KWNKdHZx0krx0lLny5OeBDq53535jgopEOfiv/nzAXJw2GGk4frVm9wAb0zed0G4/1DW0OouM1DB3F+63cv1oj3vXcSRc31YFZGX7bIAEUt5CQHO G03ypVOJPmRf9m40fX+g8aoG9K8Ev2CXgPUJr+c35etgSDRvGvUy1NOsIyjjplfH4H5PawrCurzTeTdNc3KpxZsLtN9BQ1q5ju X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4c87fac-6566-4efe-e519-08dbf7a74e40 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB3586.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 04:36:56.5933 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR10MB5160 Received-SPF: pass client-ip=2a01:111:f400:7d00::824; envelope-from=m.kalandyk@outlook.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275717 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Patch fixes lack of syntax highlighting for default arguments using python-ts-mode In GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Guix System Configured using: 'configure CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash --prefix=/gnu/store/475y8j60g7ixylvfh3viwnfl6i5j4fcj-emacs-next-tree-sitter-29.0.91 --enable-fast-install --with-modules --with-cairo --with-native-compilation --disable-build-details' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=patch.patch diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4b940b3..b625948 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1121,7 +1121,8 @@ fontified." name: (identifier) @font-lock-function-name-face) (class_definition name: (identifier) @font-lock-type-face) - (parameters (identifier) @font-lock-variable-name-face)) + (parameters (identifier) @font-lock-variable-name-face) + (parameters (default_parameter name: (identifier) @font-lock-variable-name-face))) :feature 'function :language 'python @@ -2825,26 +2826,26 @@ of `exec-path'." (let ((env (append (when (fboundp 'tramp-get-remote-locale) ;; Emacs<24.4 compat. (list (tramp-get-remote-locale vec))) - (copy-sequence env))) + (copy-sequence env))) (tramp-end-of-heredoc (if (boundp 'tramp-end-of-heredoc) tramp-end-of-heredoc (md5 tramp-end-of-output))) - unset vars item) + unset vars item) (while env (setq item (split-string (car env) "=" 'omit)) (setcdr item (mapconcat #'identity (cdr item) "=")) (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) - (push (format "%s %s" (car item) (cdr item)) vars) - (push (car item) unset)) + (push (format "%s %s" (car item) (cdr item)) vars) + (push (car item) unset)) (setq env (cdr env))) (when vars (tramp-send-command vec (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s" - tramp-end-of-heredoc - (mapconcat #'identity vars "\n") - tramp-end-of-heredoc) + tramp-end-of-heredoc + (mapconcat #'identity vars "\n") + tramp-end-of-heredoc) t)) (when unset (tramp-send-command @@ -6538,9 +6539,9 @@ recursively." (python--list-imports-check-status status) (goto-char (point-min)) (while (not (eobp)) - (push (buffer-substring-no-properties (point) (pos-eol)) + (push (buffer-substring-no-properties (point) (pos-eol)) lines) - (forward-line 1)) + (forward-line 1)) (nreverse lines))))) (defun python--query-import (name source prompt) @@ -6666,7 +6667,7 @@ asking." (push (match-string 1) undefined)) ((looking-at ".*'\\([^']+\\)' imported but unused$") (push (match-string 1) unused))) - (forward-line 1)))) + (forward-line 1)))) ;; Compute imports to be added (dolist (name (seq-uniq undefined)) (when-let ((statement (python--query-import name --=-=-=--