From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62092: 30.0.50; "case" does not work as dedenter in Python Date: Sun, 26 Mar 2023 05:04:12 +0300 Message-ID: <39f89289-3659-89c0-2d69-b7dd7d5f2391@yandex.ru> References: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28791"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Cc: Lele Gaifax , 62092@debbugs.gnu.org To: kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 26 04:05:12 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 1pgFkt-0007LF-VO for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Mar 2023 04:05:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgFkm-0001bW-03; Sat, 25 Mar 2023 22:05:04 -0400 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 1pgFkk-0001bK-Ug for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 22:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgFkk-00035a-Lq for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 22:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgFkk-0004KB-9o for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 22:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2023 02:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62092 X-GNU-PR-Package: emacs Original-Received: via spool by 62092-submit@debbugs.gnu.org id=B62092.167979626216562 (code B ref 62092); Sun, 26 Mar 2023 02:05:02 +0000 Original-Received: (at 62092) by debbugs.gnu.org; 26 Mar 2023 02:04:22 +0000 Original-Received: from localhost ([127.0.0.1]:43723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgFk6-0004J4-Dd for submit@debbugs.gnu.org; Sat, 25 Mar 2023 22:04:22 -0400 Original-Received: from mail-wm1-f47.google.com ([209.85.128.47]:40848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgFk4-0004Ip-PI for 62092@debbugs.gnu.org; Sat, 25 Mar 2023 22:04:21 -0400 Original-Received: by mail-wm1-f47.google.com with SMTP id fm20-20020a05600c0c1400b003ead37e6588so5274172wmb.5 for <62092@debbugs.gnu.org>; Sat, 25 Mar 2023 19:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679796255; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=f7CvMaPKq8xqLRB9VB6KdNR1/TuHYN2nONmAV3QFQzs=; b=OTdbTHiLeSgwqrrq498jW3LY1v9lL2OkI9ILY7mKLOVh8XpyOHRHZWr/LtX1fFB1Jd PK2XsMUYiN+I2n/4yNlHIjAvf4YIrDg1A9Z3M/XfwdcbxqgTwvYASr9vXJh5QLfTZ5vW 5cz93M8IYXEI+63Kh5DMwH04c+SXqKi0G61Km4X8ITCFNcubtZEdNY4UNCf5ctBgu4g2 bIAjK3iDzBRJ98DiBWXcNrbWnFzUtokph2EVEHKJLb6B7jJR7OcHU9EFaxdCmt/Bs1di TeqfTAcrjkhsfbeFzaYJArolP8TdG2X9YqCQZuhzwd4q2TgPVqR7vI9yLdUrrBV7J30M v/Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679796255; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f7CvMaPKq8xqLRB9VB6KdNR1/TuHYN2nONmAV3QFQzs=; b=XxlyYe6vmlZ/XwOgaBA8m93B7mFVoWXajIKoojU4LiWRGk0ZR77lNV9Jg8f6uUxjYr 0pgkRtwsy4AxU0mmhtmT2q9EBTbbLpoRLq7nKuFiAxpYqMWjCZ8uuydfKBCzXU+n8Ksd 3uMbsCZlhCh4w/q4pQ2qL4fPRX7m3++rsDysaAf0MnH5QNjClPDkj1iHPayBOZP2cWaM DlkjkoA2JbWrhm8OVyBCbWsDpgKyKZI0O9YNmPhi67Z+B18/Gj96HaWbVTGEy6I98dkp 5OscjS6sXAkHFTBI051y2cVvaHHko3fVJSZxQHaogue7fB0suHwW8m3LkNshFaAGxd22 R3OA== X-Gm-Message-State: AO0yUKX4D0DXXZIMmY3HwDjjUxZaSiWEoe6IwrQYx9oQlbQZU1PIzLjL 9icIdgyniXBos6txB4BxnK8= X-Google-Smtp-Source: AK7set9SkF0laddAOV9m1/9TfAuEgYwUduVT7Ia7tJLLdGKohRdQCDW9f1nrZeU2k+xeE+DHc8ofTQ== X-Received: by 2002:a05:600c:225a:b0:3ed:8d2e:59a0 with SMTP id a26-20020a05600c225a00b003ed8d2e59a0mr5651302wmm.10.1679796254831; Sat, 25 Mar 2023 19:04:14 -0700 (PDT) Original-Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c1d0f00b003eb2e33f327sm15743018wms.2.2023.03.25.19.04.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 19:04:14 -0700 (PDT) Content-Language: en-US In-Reply-To: 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:258641 Archived-At: On 25/03/2023 16:13, kobarity wrote: > > Dmitry Gutov wrote: >> Pushed your change to emacs-29, and closing. Thanks! > > Thank you for applying the patch. However, I overlooked one problem. > > #+begin_src python > match a: > case 1: > match b: > case 2 > #+end_src > > When I type ":" at the last line after "case 2", the message "Closes > case 1:" is shown. This is wrong because it cannot be the "case" > block of the outer "match" block (match a:). I'm sorry if you were > mentioning this case. Not really, I wasn't thinking about this one in particular. > Similar message can be shown with "elif": > > #+begin_src python > for c in (1, 2): > if a == 1: > for d in (3, 4): > elif b == 1: > #+end_src > > However, this is not a correct Python code because "elif" cannot be > the first sentence in a block. > > Dedenters other than "case" can never be the first sentence of a > block, whereas "case" can be the first sentence of a block. > > So I think it is appropriate that the first "case" in the block should > not be considered a dedenter. Attached is a patch to add a condition > in `python-info-dedenter-statement-p'. Thanks! I've pushed it to emacs-29 as well.