From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 10 00:33:29 2023 Received: (at submit) by debbugs.gnu.org; 10 Mar 2023 05:33:29 +0000 Received: from localhost ([127.0.0.1]:53467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paVNg-0002nQ-Kc for submit@debbugs.gnu.org; Fri, 10 Mar 2023 00:33:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:46386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paVNf-0002nI-6v for submit@debbugs.gnu.org; Fri, 10 Mar 2023 00:33:27 -0500 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 1paVNe-0002NG-Np for bug-gnu-emacs@gnu.org; Fri, 10 Mar 2023 00:33:26 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paVNc-0003TM-Vu for bug-gnu-emacs@gnu.org; Fri, 10 Mar 2023 00:33:26 -0500 Received: by mail-pf1-x432.google.com with SMTP id ce7so2924878pfb.9 for ; Thu, 09 Mar 2023 21:33:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678426401; h=mime-version:user-agent:subject:cc:to:from:message-id:date:from:to :cc:subject:date:message-id:reply-to; bh=Pf1KAmaCiTCbo6ouc1fZcglvbN+4d2dNZiaAwlFaImI=; b=p7RJGX2i4UWyAGQvTTFd80N83/BlKnc0lKYrvEDEVopOn1nKUtx5rjIiaa6IF8pfT6 MjcDTQJEmg+bSTich44Ds+iaDi6Pd2xGJSN4/A/CmeL6ZQhMsEnSQzMNbw+LUMlxeG2F J7ZkKAgPmwBkHOEWKm8QMM+zxeCFchA7idhvVaQ7GPa68c+Iuh54Dj9K6pDES6nu6eY0 IfLD9HdW+XizuFSqSCRIxfY/KBfsRp2XutRwbR++5eAoTNKXIs1kKl/lbKn8h4sXGMEz lhmcJnRgVIQikigiqCYzm740QGP3FkgRcwgayHvruN9eYMcmVGpOrtR3sAeoi3iolnPK Y8ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678426401; h=mime-version:user-agent:subject:cc:to:from:message-id:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pf1KAmaCiTCbo6ouc1fZcglvbN+4d2dNZiaAwlFaImI=; b=OL/m+qux7JEX0N0V26Ie0HJg6jETDgpoi5QOYVm+xBwdeFHTIyKmglTM6kjWsiiFOg 0YYGEJLRXdsTQOmkXnEacqTh7prLksbO+BTEAlg6H/SGcbUkTe/9DN6IUZVBxf+tPM+S 2gmOq4X35rlAhBPl+3OA4mJu+nPK4tR2Hb0EtW62m07nPgOfYJbKnkqaIqao/6hWrTPf Ja3p+lE1MXSEKS/tjqDpkpBcenmqTaj+DoYn39UOMgR9qbksJWBx7YgVip+DGnanOCgJ +mnHJpuXLTvK1g3Zlq8EI81FVHKt61O5jq5wsTAY+xvQSKF0oqlQEMudZULOORMwrRoZ rVfg== X-Gm-Message-State: AO0yUKUWJn01cwxjpUHhd/ce76p53TbfFJnkAU+KUpXC6gxeo4WULVnY TJJ2rnTeOI5VugT/AVjUPy8C05EzQaEevA== X-Google-Smtp-Source: AK7set/WdQkypKwoCRz8URPV997pux8RQyWfLMdKCHWBenH4JDSPBW4U561g/Ld4zhqo3Jy9W3/RHQ== X-Received: by 2002:aa7:97a2:0:b0:5a8:ea06:662 with SMTP id d2-20020aa797a2000000b005a8ea060662mr22067161pfq.20.1678426400960; Thu, 09 Mar 2023 21:33:20 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d23-20020aa78e57000000b005e00086250asm487646pfr.125.2023.03.09.21.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 21:33:20 -0800 (PST) Date: Fri, 10 Mar 2023 14:33:14 +0900 Message-ID: From: kobarity To: bug-gnu-emacs@gnu.org Subject: 30.0.50; "case" does not work as dedenter in Python User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Fri_Mar_10_14:33:14_2023-1" Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=kobarity@gmail.com; helo=mail-pf1-x432.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Lele Gaifax X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Multipart_Fri_Mar_10_14:33:14_2023-1 Content-Type: text/plain; charset=US-ASCII Hi, New keywords "match" and "case" were added to block-start in `python-rx', which enables basic indentation support for these keywords. However, "case" does not work as a dedenter. For example, try the following code. #+begin_src python match a: case 1: print(1) case 2: #+end_src At the "case 2:" line, inputting ":" does not dedent the line. Several TAB keys are needed for correct indentation. Attached is a patch to make "case" a dedenter with an ERT. -- In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2023-03-10 built on ubuntu Repository revision: 8ee205d232574e12921b052c7e93b7e16d6f1187 Repository branch: master System Description: Ubuntu 22.04.2 LTS Configured features: ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils python json subr-x map rx project pcase treesit cl-seq comint ansi-osc ring cl-loaddefs cl-lib ansi-color term/screen term/xterm xterm byte-opt gv bytecomp byte-compile rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 60054 7620) (symbols 48 7362 0) (strings 32 20143 1278) (string-bytes 1 593570) (vectors 16 11583) (vector-slots 8 139242 9455) (floats 8 30 11543) (intervals 56 239 0) (buffers 984 12)) --Multipart_Fri_Mar_10_14:33:14_2023-1 Content-Type: application/octet-stream; type=patch; name="0001-Make-case-keyword-a-dedenter-in-Python.patch" Content-Disposition: attachment; filename="0001-Make-case-keyword-a-dedenter-in-Python.patch" Content-Transfer-Encoding: 7bit >From 93801015034ee6e5072051641acab227de74082a Mon Sep 17 00:00:00 2001 From: kobarity Date: Fri, 10 Mar 2023 14:26:22 +0900 Subject: [PATCH] Make "case" keyword a dedenter in Python * lisp/progmodes/python.el (python-rx): Add "case" to dedenter. (python-info-dedenter-opening-block-positions): Add "case" to pairs. * test/lisp/progmodes/python-tests.el (python-indent-dedenters-9): New test. --- lisp/progmodes/python.el | 5 +++-- test/lisp/progmodes/python-tests.el | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 630250c15c3..2d85d059d97 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -426,7 +426,7 @@ python-rx (or "def" "for" "with"))) symbol-end)) (dedenter (seq symbol-start - (or "elif" "else" "except" "finally") + (or "elif" "else" "except" "finally" "case") symbol-end)) (block-ender (seq symbol-start (or @@ -5784,7 +5784,8 @@ python-info-dedenter-opening-block-positions (pairs '(("elif" "elif" "if") ("else" "if" "elif" "except" "for" "while") ("except" "except" "try") - ("finally" "else" "except" "try"))) + ("finally" "else" "except" "try") + ("case" "case"))) (dedenter (match-string-no-properties 0)) (possible-opening-blocks (cdr (assoc-string dedenter pairs))) (collected-indentations) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 6928e313dc4..7bb6f8617e7 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1658,6 +1658,21 @@ python-indent-dedenters-8 (python-indent-line t) (should (= (python-indent-calculate-indentation t) 6)))) +(ert-deftest python-indent-dedenters-9 () + "Test de-indentation for the case keyword." + (python-tests-with-temp-buffer + " +match a: + case 1: + print(1) + case 2 +" + (python-tests-look-at "case 2") + (should (eq (car (python-indent-context)) :at-dedenter-block-start)) + (should (= (python-indent-calculate-indentation) 4)) + (python-indent-line t) + (should (= (python-indent-calculate-indentation t) 4)))) + (ert-deftest python-indent-inside-string-1 () "Test indentation for strings." (python-tests-with-temp-buffer -- 2.34.1 --Multipart_Fri_Mar_10_14:33:14_2023-1-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 10 02:37:09 2023 Received: (at 62092) by debbugs.gnu.org; 10 Mar 2023 07:37:09 +0000 Received: from localhost ([127.0.0.1]:53578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paXJN-00068M-Fz for submit@debbugs.gnu.org; Fri, 10 Mar 2023 02:37:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paXJL-000689-EW for 62092@debbugs.gnu.org; Fri, 10 Mar 2023 02:37:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paXJF-00080D-4n; Fri, 10 Mar 2023 02:37:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=y/C4PIbt0EWtFee0SapY9zQxR3J9+j3uOra55EzTX+A=; b=XGoKHNNxvI2n Xy4lLgvPHy1ks2hCjYNR+4PHgRzgdL+04xHVQ9VTpPxjgchypoRiQS8LiZWBpPt1wfPuqqR++8/vj wcQJO/8O6i3Sgv2cwEnWmZUfRrTc1gUyfbZ7Utz65QPVnU4bGo5KPdWoWjtkDPzWg2IKPiB4JcZ5h dtjMuJcgnMqqCdRJTjgFMBtvhrNOwhIz51h9OleDfySo6m2Orr6c+5aTzBkQXByt6u67GlFnKUuD9 QYkEZDqzVWXcGBAgX8TNN1ly64JV12gu55cVOUQjtqzVk/5d4zowBkHNrLps6VtVMHQZEXo88cdGk j3tvtay23DlHuw+m2kG8MQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paXIx-0004G8-4t; Fri, 10 Mar 2023 02:36:57 -0500 Date: Fri, 10 Mar 2023 09:36:25 +0200 Message-Id: <834jqt12iu.fsf@gnu.org> From: Eli Zaretskii To: kobarity In-Reply-To: (message from kobarity on Fri, 10 Mar 2023 14:33:14 +0900) Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62092 Cc: lele@metapensiero.it, 62092@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: Lele Gaifax > Date: Fri, 10 Mar 2023 14:33:14 +0900 > From: kobarity > > New keywords "match" and "case" were added to block-start in > `python-rx', which enables basic indentation support for these > keywords. However, "case" does not work as a dedenter. For example, > try the following code. Could you please tell in which version of Emacs did we add those new keywords? It's important for deciding on which branch to fix the problem. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 10 03:27:14 2023 Received: (at 62092) by debbugs.gnu.org; 10 Mar 2023 08:27:14 +0000 Received: from localhost ([127.0.0.1]:53636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paY5q-0007O6-2E for submit@debbugs.gnu.org; Fri, 10 Mar 2023 03:27:14 -0500 Received: from mail-pj1-f50.google.com ([209.85.216.50]:35581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paY5o-0007Nr-KY for 62092@debbugs.gnu.org; Fri, 10 Mar 2023 03:27:12 -0500 Received: by mail-pj1-f50.google.com with SMTP id m8-20020a17090a4d8800b002377bced051so9068286pjh.0 for <62092@debbugs.gnu.org>; Fri, 10 Mar 2023 00:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678436827; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=BNDsXl8LZpcDR62Jf19lvbCdB0wC2e9t1uUDDNGW8xU=; b=fitYHbpCYQIGmrmsdAf3RlzzxXGps9PrIOv9xRr4PK+Ug04y5iDFGB7eiiW7AitXMW 0wFKv15c4Mmo5NqqQcNaUfzoXOai806v5IY0Jp1QwKQRo56TWvhWaXhABHKE9MnOGA+x CydmxKBj2RorMscuOaNj6ZM1BhaRTAcUp6OQips0EEG+cdIx4+xVHN6fXVYpO+9zA90Q Od13jZoQkbdMpv0JN7YIkonowBzoF8xwmXmmsnVHff3mSRApyEJxZBtawWmctuND8fK3 ATieeeOjUB+QtCT70GIOuQ+KYRfwBBHaeQDORorcWGkvSTdtmMw49Mptoqmr55RPWyBf jYkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678436827; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BNDsXl8LZpcDR62Jf19lvbCdB0wC2e9t1uUDDNGW8xU=; b=YbpB99VdbsNGM666chmdKJFJ+vfXqOgCVCDYwR4pPIQ4hHsBT+mJWeI78t1D7lplBz eBhKg54hGlgG/M840XwnOKzJX+nIclv4rBmyz2zNLQVjaoCjDHmouX97QfRzK831hArY U/SSfWz/DIsuaDoJAexGsOPfJCr6njhEIqPYoSCIl0VxK06MkrcWxj5GZQAmVSk5dfFx 4CahSEWtMmgBYsEKC2MDLUcCf8mJQ62S6NrssjmdS1IY3BDtuFfMzbpBNADMMmorheSY JcxBP5ny9CCAr1g8Ej7iYjP+5DpolhMnviAC+9rDrzCWSugu/7mUFQmoZx6fFIJDcaF+ 8S4w== X-Gm-Message-State: AO0yUKXT8N9zkxA4+LXvHMB67pPWFt/kyemZiUROdqTldbMXBrd/ozXD ErpG89ENpGEg61WUL0y6k28= X-Google-Smtp-Source: AK7set9LpLm0D01Q5juCJtoyxWzScnR1kW5x/zwv6si3qmKxWVGLDIcOcojsxhBGoRkEkIXSTI1+ZQ== X-Received: by 2002:a17:902:edcd:b0:199:1b8a:42a8 with SMTP id q13-20020a170902edcd00b001991b8a42a8mr20826548plk.6.1678436825770; Fri, 10 Mar 2023 00:27:05 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id ll5-20020a170903090500b00199193e5ea1sm900720plb.61.2023.03.10.00.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 00:27:05 -0800 (PST) Date: Fri, 10 Mar 2023 17:27:02 +0900 Message-ID: From: kobarity To: Eli Zaretskii Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python In-Reply-To: <834jqt12iu.fsf@gnu.org> References: <834jqt12iu.fsf@gnu.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: lele@metapensiero.it, 62092@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii wrote: > Could you please tell in which version of Emacs did we add those new > keywords? It's important for deciding on which branch to fix the > problem. Sorry for the lack of information. Those keywords were added in Bug#55572. The commit ID is 35d0190b0b91c085c73bbe6c2b8e93ea8288b589. So I think it's only for Emacs 29. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 10 19:28:07 2023 Received: (at 62092) by debbugs.gnu.org; 11 Mar 2023 00:28:07 +0000 Received: from localhost ([127.0.0.1]:56183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pan5j-0001ON-Gc for submit@debbugs.gnu.org; Fri, 10 Mar 2023 19:28:07 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:53133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pan5i-0001Nr-73 for 62092@debbugs.gnu.org; Fri, 10 Mar 2023 19:28:06 -0500 Received: by mail-wm1-f46.google.com with SMTP id j3so4501000wms.2 for <62092@debbugs.gnu.org>; Fri, 10 Mar 2023 16:28:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678494480; 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=DwZC2NV2+gEPWsy6VMFNeiNZOqBA4KKrDKXVRUyNEz8=; b=i9s/pTcqa+bZxlB4539ly8bu42GZeaIbULV/gBA2RZHe5gufW32f9awJ8dzxeh81IP 8ANTRUqHgY12+kwv07Q+q2iP5aA7LKOGkp/zqegOm9oWMJ1XUq8It09PRLU0ukt8Rl59 697w5zXUOcw2/eKsK9qM1HbCaX3URyqWifPqfxjJQ7IyVrAD1/sUKsINy4dam+/gj47T VNC2+QY0s1jzvBajGWlGDJWdmGWHCuQJXnuIWCxKYfCQGEfHHXQ+C98DGzgbhvcPwC4c QhWDfAYtdkcxxql5GX7P+zapHv/eo5gWLOBDMCJtYPmaGf04X7RRkLk0KxFImBhuaOrJ V33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678494480; 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=DwZC2NV2+gEPWsy6VMFNeiNZOqBA4KKrDKXVRUyNEz8=; b=OCwRLiZYDmriRthrJi6AUqN+6flbnAXvg5PxzLThxqXvf04azmLpxV3LH6osu9vvkJ jGbpQS5rE5dnr/99WiTes1MTpwQAVYmOH0xG3RIc85ClxRWdgYUpoAxGJ9zwWsBhzDUX Ygy8APg65m1Ld2apjfMhpAv3ygb47xK+sqCbXNlDuaWk3YhudakB7HammYNgxXE2Xv8R GR7zGNHVhdxZrtLMNGfg/KWwQOUiY4U5wu3/aGNMDz88ZCZF2bQNsslC8ibnyL0cY2W/ id5LgITSRz97aZGRIYP5aZLMdzEEdEjAuNzsXHIk1rS43cwS97hPSskW5uDdEIzNrMgz o4Vw== X-Gm-Message-State: AO0yUKWYEnSR7VEi5qxqz3h1DtgxucfPo3WpLHHpGhqTKZ16w6EhRmy+ y1mZFFg+RFU6TqErUpdTGdM= X-Google-Smtp-Source: AK7set9bQU85bAzne5I2OkwgA8eo9ptfAVZUXEXVwzl8LanSBPBqCCZm8cVwY9De0HkQdHF1UQWGKw== X-Received: by 2002:a05:600c:b52:b0:3df:9858:c030 with SMTP id k18-20020a05600c0b5200b003df9858c030mr2754680wmr.5.1678494479872; Fri, 10 Mar 2023 16:27:59 -0800 (PST) Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id k7-20020a7bc407000000b003eafc47eb09sm182058wmi.43.2023.03.10.16.27.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Mar 2023 16:27:59 -0800 (PST) Message-ID: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> Date: Sat, 11 Mar 2023 02:27:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python Content-Language: en-US To: kobarity , 62092@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 10/03/2023 07:33, kobarity wrote: > Attached is a patch to make "case" a dedenter with an ERT. Here's a minor issue with it, probably not critical: I type the colon after 'case 2', see it indented correctly, but also a message in the echo area: Closes case 1: I type the next case with colon and see: Closes case 2: and so on. They don't do much harm, but they still seem semantically incorrect. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 10 21:08:43 2023 Received: (at 62092) by debbugs.gnu.org; 11 Mar 2023 02:08:43 +0000 Received: from localhost ([127.0.0.1]:56317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paof5-0004Fd-GV for submit@debbugs.gnu.org; Fri, 10 Mar 2023 21:08:43 -0500 Received: from mail-pl1-f180.google.com ([209.85.214.180]:42822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paof3-0004FQ-J5 for 62092@debbugs.gnu.org; Fri, 10 Mar 2023 21:08:42 -0500 Received: by mail-pl1-f180.google.com with SMTP id i10so7508156plr.9 for <62092@debbugs.gnu.org>; Fri, 10 Mar 2023 18:08:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678500516; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=kcyAOAXnC/jpD6cMddVvYBp7fkrtsAS445oTcZrt4bQ=; b=oE2gSH+pUSN75fM5PhJX6611rGHW4dKGVXFYa9HUcrBtXCniHCXs/IdnjanTfls+Qs 91D5oM43K1lkNYrLTY+6zRo8W1Yy+mEQF1W4nHEQJcmC1BJcUZ/CXx9p2TuqkLni1jKu 9b5ONrb2VY+Cq+ynk5c1kN3tUwoa+vXgMBvkAkx3usRd8c4p0fCUKqLQByt0nNYpLoOX 8l88KCjGmL5NiRaWTJgvKaEpHOn5z/tHXRiASIFZ/isjXoRXuvHN+wqnnZE+vUI5n9iX iSJbHX8SeYh+Z8ys3nH/ZE+DQaSmMyYktxiJqR2TjwmOFDDz1ADk5vi12ooviQgZ9bHm Z1uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678500516; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kcyAOAXnC/jpD6cMddVvYBp7fkrtsAS445oTcZrt4bQ=; b=Z6o/oShcQhHpsc7HTJv1FIDIXS/BYZr3/aNOsnzosYAdTcSsBt1OOX3tOrsbWmPQxO MeYFPXuEouU54lTiwBh9MkNKDOrwx+SiWp1ha11nFvFhDa0DdiL1zQZme+Dr8hrTobiq vFfktCggHSdFJG12sfOBz9/Yl7sFEvTT6O4drVnAvM9XEljEBXZyZNr/jG9dHZDwyTTm CWO3k140G94G/HR8l437n3xLNErHWrOSFwKlvyjXGG7sVYA8yo3uOThMfumyctCxNrF0 aReiA4s8X2+igVY6emmdkFdCToz9rbfqV1tjACPgVgy2qliUMH+K8vsymDmItVB+QZ8u v12w== X-Gm-Message-State: AO0yUKV+mslJr0jTdwd8zPiZS98VKalixHxQNb0UwTXzF1do3Myq8zH9 N1sAy/xUv94ATr1zWI9m2W0= X-Google-Smtp-Source: AK7set95BKjER5c15kaYLoJ1N4nOOPLRPTRl5YtPfeV529iD+06J7qQs7/yhSJ9EZUrT9FZwz9RzUg== X-Received: by 2002:a05:6a20:6a9e:b0:cc:f047:afaf with SMTP id bi30-20020a056a206a9e00b000ccf047afafmr23736062pzb.11.1678500515667; Fri, 10 Mar 2023 18:08:35 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id a5-20020a656405000000b00502f017657dsm481174pgv.83.2023.03.10.18.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 18:08:35 -0800 (PST) Date: Sat, 11 Mar 2023 11:08:32 +0900 Message-ID: From: kobarity To: Dmitry Gutov Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python In-Reply-To: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> References: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dmitry Gutov wrote: > I type the colon after 'case 2', see it indented correctly, but also a > message in the echo area: > > Closes case 1: > > I type the next case with colon and see: > > Closes case 2: > > and so on. They don't do much harm, but they still seem semantically > incorrect. Thank you for testing my patch. I don't think this is a incorrect message. Let's discuss with the following code: #+begin_src python match a: case 1: print("a = 1") match b: case 2: print("b = 2") case 3 #+end_src When I type ":" at the last line after "case 3", it will be indented as follows: #+begin_src python match a: case 1: print("a = 1") match b: case 2: print("b = 2") case 3: #+end_src The message "Closes case 2:" is shown. It means that the "case 3:" corresponds to the "case 2:" in the inner "match" statement, not the "case 1:" in the outer "match" statement. When I type TAB twice, the line will be indented as follows: #+begin_src python match a: case 1: print("a = 1") match b: case 2: print("b = 2") case 3: #+end_src The message "Closes case 1:" is shown. It is shown to help distinguishing nested blocks, although it will not be useful if the case statements are same. This is the same behavior as "if" blocks, etc. The term "Closes" may not be the most appropriate for "case," but I don't think it is wrong. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 11 08:18:23 2023 Received: (at 62092-done) by debbugs.gnu.org; 11 Mar 2023 13:18:23 +0000 Received: from localhost ([127.0.0.1]:56776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paz79-00023r-66 for submit@debbugs.gnu.org; Sat, 11 Mar 2023 08:18:23 -0500 Received: from mail-wm1-f45.google.com ([209.85.128.45]:39601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1paz77-00023d-4C for 62092-done@debbugs.gnu.org; Sat, 11 Mar 2023 08:18:21 -0500 Received: by mail-wm1-f45.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso7933761wmi.4 for <62092-done@debbugs.gnu.org>; Sat, 11 Mar 2023 05:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678540695; 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=awZGMSGyKVoN7KCmOy2KHUjOP+QFP4rbrBR74us+e1M=; b=n7w+kjP+XyaYAl8kA/CAuSXRbBZVjVXqYwqm0hqwZw6qJYr2a4tA6csC0jzBuv3Rzu FWUKrCoHbDKfD8aT7y1KB6ONLWhWwuVQGQiY3BzID72bdhduEuwLVpyaKCcfGu7yt5RV 1/53jH4HYcePXTA9Hbvtvec/2NR2DJkDCgFsGVTYmQE1IYmRIdylCpNsYWOFW3XF2Jt4 g+0Pplj007+ALHoeRWLP6y+saFlLQhEuRdpyCSMqTFU3qXJ3gI+/17XQio0Njlu7g3d7 CRf1k8zH9Oqh2xhvzK9FxFMakmLLIm/4FP/1xDkD72i9QbKU58XNJyNqiiX92rcdafZ4 iP2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678540695; 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=awZGMSGyKVoN7KCmOy2KHUjOP+QFP4rbrBR74us+e1M=; b=bzwf/WXcW9UZovG8lwlsARLPhmaobg0Q7RdIRpbgLEqyBscq8i6jAvTjOgL7+8JLlq 6Oe3XCkfFbPCDsa2rLly6kPoI7pZb7ibXZj9QbNAr0vIuHDlAzQXKmC7yvy1PnYE6wJa i1HnIRVYTA3Qr4wiAP5/JPz+2qSKv77qhU/dB0vA+6+/4hffAa47BMlPtbYSntF/6Fkb zuyLbqIEoM13bxXrGGtMUzfUWCcvseBEFFsel58JTZR+yPkMTaOT/JyVNpv504qDc27T fviPHtwqn4gdHuRg8Gebw4+4cfose8w3DvIWI7AtmYHI7M/WNgla5aZAthAsfnbRceIY xS/A== X-Gm-Message-State: AO0yUKUqCQgLkdNxzVVDVJR/Ss2YkIS6RDAUBAfZ8QcxK/zqq8ohKBmB NQ9AuPYgua0JwXNFBXmruUs= X-Google-Smtp-Source: AK7set+RvsdKNNb86uaarChy/pvvt6fz3RDz2DlAa+rTywBZ2AX0ZHN9PobhpX9mXtyhhY5xMKdgAA== X-Received: by 2002:a05:600c:1c82:b0:3ea:82a9:3644 with SMTP id k2-20020a05600c1c8200b003ea82a93644mr5573869wms.34.1678540695086; Sat, 11 Mar 2023 05:18:15 -0800 (PST) Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id p17-20020a056000019100b002be5bdbe40csm2489758wrx.27.2023.03.11.05.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Mar 2023 05:18:14 -0800 (PST) Message-ID: Date: Sat, 11 Mar 2023 15:18:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python Content-Language: en-US To: kobarity References: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 62092-done Cc: Lele Gaifax , 62092-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) On 11/03/2023 04:08, kobarity wrote: > The message "Closes case 1:" is shown. It is shown to help > distinguishing nested blocks, although it will not be useful if the > case statements are same. > > This is the same behavior as "if" blocks, etc. The term "Closes" may > not be the most appropriate for "case," but I don't think it is wrong. Fair enough. I do think it's not ideal ("case" is not a "closer"), but neither is "else", for that matter. So the issue is not new. And it can be useful, like you say, to distinguish nested blocks. Pushed your change to emacs-29, and closing. Thanks! From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 25 10:13:39 2023 Received: (at 62092) by debbugs.gnu.org; 25 Mar 2023 14:13:39 +0000 Received: from localhost ([127.0.0.1]:43147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg4eJ-000867-Hh for submit@debbugs.gnu.org; Sat, 25 Mar 2023 10:13:39 -0400 Received: from mail-pj1-f46.google.com ([209.85.216.46]:45583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg4eI-00085u-0E for 62092@debbugs.gnu.org; Sat, 25 Mar 2023 10:13:38 -0400 Received: by mail-pj1-f46.google.com with SMTP id p3-20020a17090a74c300b0023f69bc7a68so4185213pjl.4 for <62092@debbugs.gnu.org>; Sat, 25 Mar 2023 07:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679753604; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=BngzbsZ6TtD8iO6kPBA4QnOkNNn+qHV+23b1ehonN/s=; b=W3kA9iAT1eWvYrYnt+89BuR/VG7ZreI1/eCL76nnUnt1tG3psSiuW2Eq7fCEWspVgk GWOHynnsmygd7VHq14Qb+Aza5ifl+Zi1Y49BGIDylyflG49EGniIkpgiW1fw3CYlWcmi eWXQbH3qNoPg33OU2s+T0JFWWujFEJo0fsB+nKmS6rJQcnKh8642DiV4mN9tmRTonSmj aA7rN/8TVJGGYP5+dbHcM15WFWibh6lgxsBE+Og8aJwdastTLxCJ8rzonqPU0sClmvex pRxJlqPXL4MT7/m+kAP7Wa03nWUkmqps4jK+Fbin+fe2azgRli3dNsaafOApW6WMEtcM Cmjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679753604; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BngzbsZ6TtD8iO6kPBA4QnOkNNn+qHV+23b1ehonN/s=; b=XoCK9fGqsyEG7hLKWEKSJ0uzUYrVgVFyc+gFzMuooothbYRmJdImR0TQV8Wr/Wwv6j xD8n6tyOTx64hAqmxuQK7kXTxxBJNxyPB3KL9RCw17hxByspT4Kt+TsKGrj+bdai8DVh ShHrwzyzDpsLaA9gDiwQpthyTMCNKE1XKHtgFHKBRt8+jRWp5j2uYNM4du5zYvrcLfJw C47IKA/cK+QnPYMpfqj8cS1wT/3PQCcGjduvAtt0gP7d965ZVc3ESBK3OVxT6JDHlXt2 +ZRTV6xZbraINey/pwhuVt+R/ibiOXTl5wbJgRc87jc67cOLOBSViSqedzIhSU6mG8My 9hxA== X-Gm-Message-State: AAQBX9ee98cJmO4b4ZJlRa8+OGbNBTyw5WSKfwjxjApDKweOABRF4fqO scno5xJdyF0zpOdNnZgX+2s= X-Google-Smtp-Source: AKy350atPa/PFiAt5fLcaCVVR4WjusCS2/QTKT0Kr4on8wpUKZ4OYZ4s76/A9I/FW1n8TfmhyPUhvA== X-Received: by 2002:a17:903:32d2:b0:19e:68b1:65b9 with SMTP id i18-20020a17090332d200b0019e68b165b9mr8021515plr.12.1679753603838; Sat, 25 Mar 2023 07:13:23 -0700 (PDT) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id p6-20020a1709028a8600b00194c2f78581sm16002855plo.199.2023.03.25.07.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 07:13:23 -0700 (PDT) Date: Sat, 25 Mar 2023 23:13:06 +0900 Message-ID: From: kobarity To: Dmitry Gutov Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python In-Reply-To: References: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sat_Mar_25_23:13:03_2023-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Sat_Mar_25_23:13:03_2023-1 Content-Type: text/plain; charset=US-ASCII 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. 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'. --Multipart_Sat_Mar_25_23:13:03_2023-1 Content-Type: application/octet-stream; type=patch; name="0001-Improve-indenting-case-in-Python.patch" Content-Disposition: attachment; filename="0001-Improve-indenting-case-in-Python.patch" Content-Transfer-Encoding: 7bit >From f0dafe85cb78b0510e70fe7b1d093d013aea9008 Mon Sep 17 00:00:00 2001 From: kobarity Date: Sat, 25 Mar 2023 22:59:05 +0900 Subject: [PATCH] Improve indenting "case" in Python * lisp/progmodes/python.el (python-info-dedenter-statement-p): Do not consider the first "case" in the block as dedenter. * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-7) (python-info-dedenter-statement-p-6): New tests. (Bug#62092) --- lisp/progmodes/python.el | 9 ++++++- test/lisp/progmodes/python-tests.el | 38 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2fe88323c35..bbabce80b4d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5854,7 +5854,14 @@ python-info-dedenter-statement-p (save-excursion (python-nav-beginning-of-statement) (when (and (not (python-syntax-context-type)) - (looking-at (python-rx dedenter))) + (looking-at (python-rx dedenter)) + ;; Exclude the first "case" in the block. + (not (and (string= (match-string-no-properties 0) + "case") + (save-excursion + (back-to-indentation) + (python-util-forward-comment -1) + (equal (char-before) ?:))))) (point)))) (defun python-info-line-ends-backslash-p (&optional line-number) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index ed4a08da6ab..50153e66da5 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5940,6 +5940,26 @@ python-info-dedenter-opening-block-positions-6 (equal (list (python-tests-look-at "if (" -1 t)) (python-info-dedenter-opening-block-positions))))) +(ert-deftest python-info-dedenter-opening-block-positions-7 () + "Test case blocks." + (python-tests-with-temp-buffer + " +match a: + case 1: + match b: + case 2: + something() + case 3: +" + (python-tests-look-at "case 1:") + (should-not (python-info-dedenter-opening-block-positions)) + (python-tests-look-at "case 2:") + (should-not (python-info-dedenter-opening-block-positions)) + (python-tests-look-at "case 3:") + (equal (list (python-tests-look-at "case 2:" -1) + (python-tests-look-at "case 1:" -1 t)) + (python-info-dedenter-opening-block-positions)))) + (ert-deftest python-info-dedenter-opening-block-message-1 () "Test dedenters inside strings are ignored." (python-tests-with-temp-buffer @@ -6125,6 +6145,24 @@ python-info-dedenter-statement-p-5 (point)) (python-info-dedenter-statement-p))))) +(ert-deftest python-info-dedenter-statement-p-6 () + "Test case keyword." + (python-tests-with-temp-buffer + " +match a: # Comment + case 1: + match b: + case 2: + something() + case 3: +" + (python-tests-look-at "case 1:") + (should-not (python-info-dedenter-statement-p)) + (python-tests-look-at "case 2:") + (should-not (python-info-dedenter-statement-p)) + (python-tests-look-at "case 3:") + (should (= (point) (python-info-dedenter-statement-p))))) + (ert-deftest python-info-line-ends-backslash-p-1 () (python-tests-with-temp-buffer " -- 2.34.1 --Multipart_Sat_Mar_25_23:13:03_2023-1-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 25 22:04:22 2023 Received: (at 62092) by debbugs.gnu.org; 26 Mar 2023 02:04:22 +0000 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 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 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) 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) Message-ID: <39f89289-3659-89c0-2d69-b7dd7d5f2391@yandex.ru> Date: Sun, 26 Mar 2023 05:04:12 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python Content-Language: en-US To: kobarity References: <48fd0271-45d4-4f8e-0e13-f344f2fe1a31@yandex.ru> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) 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. From unknown Sat Jun 21 10:43:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 23 Apr 2023 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 14 11:06:31 2023 Received: (at control) by debbugs.gnu.org; 14 Aug 2023 15:06:32 +0000 Received: from localhost ([127.0.0.1]:34163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZ9L-0007yS-Mb for submit@debbugs.gnu.org; Mon, 14 Aug 2023 11:06:31 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:49441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZ9K-0007yF-B2 for control@debbugs.gnu.org; Mon, 14 Aug 2023 11:06:30 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4fe1b00fce2so6555432e87.3 for ; Mon, 14 Aug 2023 08:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692025584; x=1692630384; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:sender:from:to:cc:subject:date:message-id:reply-to; bh=0NQOW7SlVPo0XhLUcmaXT0qUGNXMLjNSETV+6KwH/jU=; b=Z1L4f3b8BkkK7xOncWs1+6LVCWC/hNrQHWHyTRCZlM7wKdg56O8cWMkgJrIW3s8HcO 3GivCxuv7vRxKLHO5qJof8jmVeNm8OAzVo8awAShbDrK6f76T1bGWcTQBt72SMT/b23T 5LYTYlw17lA8Zvi2ocsuq3QTZM+URVpnW1CU/GjPaFR94G3W8JYJsaLmYZJ0Jknp+ajr 5qtLNSZ9aC3gnXvqHsIUXh0kYIN62vMeFW0os6DxhNeExB7lSa9jvhEhr3r8oUbVPwBr 38XmQVgKN6GT5xGlm733A6OwVoZy5ro/35W1VHtr5IvjcOiaMVfOBqc+dmFreIXsmoDi B6uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692025584; x=1692630384; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0NQOW7SlVPo0XhLUcmaXT0qUGNXMLjNSETV+6KwH/jU=; b=QLRuw/k1tHQvk09bwPUHIAefO5hhXinBS9dKjsd9sfTSG5vRak1JRYkKkU6Td+ayBq 1iRSP+oxD1gnx0QtXd1jDPzFyz1iNTzxs6XMpqEhloAnYo36OlsOG0b48cQIjTzBZOQR nC0I92XPMZlk3ndIA6U2KWo/sSaKwhz+k9DqmD/A63fCrPT3uGhANQxaNLpOo+47Xt/x i26Mb6+TlgvtyGatgj5Bs10XxyeZ1VoGxIgXE1kwNvS8q4zp4CELiYWJKzcKhYripz3z FRg3jH2qIuKGM+xqiRVEsTQORicT9ZqDcOE2nxyNt7MgBpHQyWQUoYJSmQCNb4Hie9zm dl1A== X-Gm-Message-State: AOJu0YytXFjmXiDtrp/dBNRngcxd0z+Ly8bQ2aPtNsC9HFJG/Ln/jrJr 856LBiWRor7h1HYDrhT1hMFh/hFG4+k= X-Google-Smtp-Source: AGHT+IHBZ5UldXbqreeW8ub9FeouVQfThrqEC/j1W/h9vBultzKhBL9FuJsTgZ2OBm5XaxHsjuBsZg== X-Received: by 2002:ac2:4e0c:0:b0:4ff:7602:5879 with SMTP id e12-20020ac24e0c000000b004ff76025879mr2855729lfr.55.1692025584347; Mon, 14 Aug 2023 08:06:24 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id eo10-20020a056512480a00b004fe3ae5c5efsm1990922lfb.295.2023.08.14.08.06.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2023 08:06:23 -0700 (PDT) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: Message-Id: <49EC81B7-3573-4362-A138-EE985D8AF60B@gmail.com> Date: Mon, 14 Aug 2023 17:06:23 +0200 To: control@debbugs.gnu.org X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 62092 stop Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12e listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (mattias.engdegard[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) unarchive 62092 stop From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 14 11:12:25 2023 Received: (at 62092) by debbugs.gnu.org; 14 Aug 2023 15:12:25 +0000 Received: from localhost ([127.0.0.1]:34184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZF3-00087l-BK for submit@debbugs.gnu.org; Mon, 14 Aug 2023 11:12:25 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:51591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZF1-00087Y-1N for 62092@debbugs.gnu.org; Mon, 14 Aug 2023 11:12:23 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b9cd6a554cso65146121fa.3 for <62092@debbugs.gnu.org>; Mon, 14 Aug 2023 08:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692025937; x=1692630737; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=0k2/HpwdTjVBqkTSrbCI7CXjQLIRSYOFvM8/Ukv2hGE=; b=fAb9FkH9SL5YZVYX3jCkzy5qfWhLzpUomjE6/ntpAAeLNzTmptEeQqDmQERElut1ux URoCBPqnf/pXBCJiEfuBCtYU8eV7r5fmGYyzQWTNEZ5h//Htg2Z2IqZ/7LaJOsjwfJB0 gcfbcWWkH2nzAwflvEp+ze3NfSLnD9BCbAwweYVAmpZe+cyZr6sIkSiAuOI5xuORWocb pFB8F3dy0s/TlyqmNoOijUfMXcifZMhRIG9dmANdwLuX+KkZCHAzu735jMI7I8NBKjjX /GQAeK1YrvrZpSepPzDNcvjETktDjwjF5HncIrTyNGSo3e4uwqirBzLxMLFRmLn8YzYi YWnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692025937; x=1692630737; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0k2/HpwdTjVBqkTSrbCI7CXjQLIRSYOFvM8/Ukv2hGE=; b=AwUxibIypyPCxG3JUUvTlXPt/ZERAn9elinl4SqQTBD6KcLc/q7PaZlY0Mlu/O3fod 1RHMh3F992VjwKAcf9/qKGFnYQLQxyRb+e8vxJE1pbcpFBE22qQkv0VtQV+XrDAbTzTD Cs63K9NzO+zJQotmNbYFBYDEAyv93P6j9JzKCXpPtXQ0FfBT9JGmUFPlJMztoKtM3tKt UtCQRDrO9JLsUZIWbRgXYEchO4tX0aMiybCXw8EVhDUrLqqOmrkWa25fKQXzscVZHDrs EozBclTtvlHjQg9bx+K3Lt/Ji0nQCJlSuL99smQJKp74VqYFf8aSCxRI0VZROFRNl4p/ X6IA== X-Gm-Message-State: AOJu0Yw8MS9zPYvQ6pUfPvCoSPrB55ekdxrJvNlNN3aJ1XLEj3wN9YdK zrHnrnfE3fWCaiWq/Jknamg= X-Google-Smtp-Source: AGHT+IH+Un6AnhMA/jaMdIFLQz1gYCJVmxDEHfvW8kUB4hQ0nkhWrIaodo+EkOWeyk9j26uSaisNgw== X-Received: by 2002:a2e:968a:0:b0:2b9:53bd:47a7 with SMTP id q10-20020a2e968a000000b002b953bd47a7mr6857294lji.30.1692025936969; Mon, 14 Aug 2023 08:12:16 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id r16-20020a2e80d0000000b002b6dba16f28sm2431312ljg.127.2023.08.14.08.12.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Aug 2023 08:12:16 -0700 (PDT) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: bug#62092: 30.0.50; "case" does not work as dedenter in Python Message-Id: Date: Mon, 14 Aug 2023 17:12:15 +0200 To: kobarity X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) The test python-info-dedenter-opening-block-positions-7 added as part of = this bug in 8f42db010d ends with + (equal (list (python-tests-look-at "case 2:" -1) + (python-tests-look-at "case 1:" -1 t)) + (python-info-dedenter-opening-block-positions)))) which, as you can see, isn't actually a check; the `equal` result is = thrown away. (Emacs master was just changed to detect this, so there is a = byte-compiler warning.) Unfortunately, wrapping the call in `should` fails, so there is more to = it. Would you please take a look? From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 15 09:43:45 2023 Received: (at 62092) by debbugs.gnu.org; 15 Aug 2023 13:43:45 +0000 Received: from localhost ([127.0.0.1]:35238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVuKn-0005uS-5u for submit@debbugs.gnu.org; Tue, 15 Aug 2023 09:43:45 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:42477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVuKj-0005uB-22 for 62092@debbugs.gnu.org; Tue, 15 Aug 2023 09:43:43 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-564af1b3a9fso3563234a12.1 for <62092@debbugs.gnu.org>; Tue, 15 Aug 2023 06:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692107015; x=1692711815; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=VHwBio2VAG7FiJrjxFC0W/+qbPy5eZWKmQY5tRSvkgc=; b=KeTFy2jt1XkI2+BJtv05isMnZpQYKYQZfcB/s/KK6V2RF9amxrrybPG6ySie4xhmVt 5mw9HhqTKBWGQOdW1iTlOkt165gE9IqtrOYFxm9r208/eh6kkLqR2ab+MAGfndKcDhil BMsbEKxLB4suwEla56zcDbb2C4qWjVBt1G34jpxnR5ax18ND5NfAVt1zeRpL7BexHVS1 rS76E5Uw5GHzP3H/eSxTEP1OFDx7uWdry5C1Vp1yu0D9PjHOgaK9R4h7etGKm6xzqrB4 +aGnNICJiFdxaFgQgCaTwOUZ8erRlM5Xtnt4gtBZN7U1hXo3AQSRKPYR+OJVD5aLYQ5I x9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692107015; x=1692711815; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VHwBio2VAG7FiJrjxFC0W/+qbPy5eZWKmQY5tRSvkgc=; b=Bf9zc1zKo3bypc+0Lvyu1kTepUuW1dpiWTereEeTBEEjGF42oiYLny8o8DDm5ln9Mp rrtvfTulxNtfuyBlCxg6SjDcXksjV8rwlJHTkzd/HMmGBovjRTTG9nW7ALlGabCA3eT6 U8vJMRDjV5l19xbTPcbwQAsjxEXUGL9KOsjNWYKEwufPTfM1NvxeWuwC8Q0FSa/Dtdkm 3sUo/2cFI4+diWq8eNaU+zyhvVQgw6XFTbx8rEYUGyIIeiBT47+WpPrWK7uwkmkKxVpz eBoHYpLdD4z+66AwNQO1NNJ/R3+cGXs6uXG8sEwGwhbHMPICuLgBTO25HcyiDczgy5eq OBTw== X-Gm-Message-State: AOJu0Yyps5YH6d4Erd5130INv1aRZQdEUqy+iKyr1AAJ3OZQrAqO3QIY AEbnWaQZ3yASMVlCcLNd5RY= X-Google-Smtp-Source: AGHT+IEASa1C0Hle9mqT8OPlJdXBSAf6Aq2ZqRcw+e1FjLPHfbE+4+ZQvfNHtKqOkabywUCxDRupGQ== X-Received: by 2002:a05:6a20:440a:b0:13a:3bd6:2530 with SMTP id ce10-20020a056a20440a00b0013a3bd62530mr2756436pzb.1.1692107014993; Tue, 15 Aug 2023 06:43:34 -0700 (PDT) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id x9-20020a656aa9000000b00563df2ba23bsm9263977pgu.50.2023.08.15.06.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 06:43:34 -0700 (PDT) Date: Tue, 15 Aug 2023 22:43:19 +0900 Message-ID: From: kobarity To: Mattias =?ISO-8859-1?Q?Engdeg=E5rd?= Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Tue_Aug_15_22:43:17_2023-1" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Tue_Aug_15_22:43:17_2023-1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mattias Engdeg=E5rd wrote: >=20 > The test python-info-dedenter-opening-block-positions-7 added as part of = this bug in 8f42db010d ends with >=20 > + (equal (list (python-tests-look-at "case 2:" -1) > + (python-tests-look-at "case 1:" -1 t)) > + (python-info-dedenter-opening-block-positions)))) >=20 > which, as you can see, isn't actually a check; the `equal` result is thro= wn away. > (Emacs master was just changed to detect this, so there is a byte-compile= r warning.) >=20 > Unfortunately, wrapping the call in `should` fails, so there is more to i= t. > Would you please take a look? Sorry, I meant to use `should'. Another mistake was forgetting to use RESTORE-POINT argument when calling `python-tests-look-at'. Attached is the patch to fix this. It also includes the indentation fix for=20 `python-info-dedenter-opening-block-positions-6'. --Multipart_Tue_Aug_15_22:43:17_2023-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-test-in-python-tests.el-added-by-bug-62092.patch" Content-Disposition: attachment; filename="0001-Fix-test-in-python-tests.el-added-by-bug-62092.patch" Content-Transfer-Encoding: 7bit >From a39bc229ae258b04f4463c4cabfbe9f1c48ee7df Mon Sep 17 00:00:00 2001 From: kobarity Date: Tue, 15 Aug 2023 22:27:45 +0900 Subject: [PATCH] Fix test in python-tests.el added by bug #62092 * test/lisp/progmodes/python-tests.el (python-info-dedenter-opening-block-positions-6): Fix indentation. (python-info-dedenter-opening-block-positions-7): Add calling `should'. Add RESTORE-POINT argument when calling `python-tests-look-at'. --- test/lisp/progmodes/python-tests.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 54e32cbf07b..9f935f2748c 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5973,9 +5973,9 @@ python-info-dedenter-opening-block-positions-6 else " (python-tests-look-at "else\n") - (should - (equal (list (python-tests-look-at "if (" -1 t)) - (python-info-dedenter-opening-block-positions))))) + (should + (equal (list (python-tests-look-at "if (" -1 t)) + (python-info-dedenter-opening-block-positions))))) (ert-deftest python-info-dedenter-opening-block-positions-7 () "Test case blocks." @@ -5993,9 +5993,9 @@ python-info-dedenter-opening-block-positions-7 (python-tests-look-at "case 2:") (should-not (python-info-dedenter-opening-block-positions)) (python-tests-look-at "case 3:") - (equal (list (python-tests-look-at "case 2:" -1) - (python-tests-look-at "case 1:" -1 t)) - (python-info-dedenter-opening-block-positions)))) + (should (equal (list (python-tests-look-at "case 2:" -1 t) + (python-tests-look-at "case 1:" -1 t)) + (python-info-dedenter-opening-block-positions))))) (ert-deftest python-info-dedenter-opening-block-message-1 () "Test dedenters inside strings are ignored." -- 2.34.1 --Multipart_Tue_Aug_15_22:43:17_2023-1-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 15 11:09:31 2023 Received: (at 62092) by debbugs.gnu.org; 15 Aug 2023 15:09:31 +0000 Received: from localhost ([127.0.0.1]:36473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVvfm-0000Hf-Nq for submit@debbugs.gnu.org; Tue, 15 Aug 2023 11:09:30 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:53359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVvfi-0000Gv-OR for 62092@debbugs.gnu.org; Tue, 15 Aug 2023 11:09:28 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fe0e34f498so8830258e87.2 for <62092@debbugs.gnu.org>; Tue, 15 Aug 2023 08:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692112161; x=1692716961; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=Xbi8+b64H7Ss7TETzKBJXm8xoXfA0Nj3xOQ34AbGZC4=; b=LS9bpYWfxFyritRI9rCHPkgFieH2rXgQkimOp7ezT56KZzXoRyN8/20VnTFWEQCl0g DWhMfxJah4soirc59sfEwJ+jQBQVcjq1HTskZljAEWn9UobfsUWRjcR8fQadCd7j/QhK lEy8itqcCzIwsoOMNtNy+Wm5uCM6Q8Zmb8SRfYOFflHUEED+S+zKe/kedt1ai0owWoCF ldnRYe2yhXyKj/0WoyjFOITxGPxtD3dQt8nmhyavGb1qSTs8NvA4e/qCNDW7vx3c/Hxn qQSeerspPVOnFeMtfUJmvLo9/oudGm1StSxuMJC/KlFSI6UlKG7iEO+yMv8EYEqaPZb+ badg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692112161; x=1692716961; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Xbi8+b64H7Ss7TETzKBJXm8xoXfA0Nj3xOQ34AbGZC4=; b=SvAA2XwZgrq+Wr/YQ4R7vIepy0T+/IPlOPp8mub/ByR5GjMSc3R087e994RL24IcT6 adJjNAAX+MY06dD0XHE8/XwxAu8IqQZF2Iy/vLkMA1DBSJfb3rHBEdbHNMLO4oBuxtgY 10rIZupgikcAJ31D02jUBQRtxR0bWECfjgz+wiRT1LZTLKzsw4CS5UvM0X/mkmw0Y3gg w1MzcVWS3nMJlNzuzFEK2zf/1RKX+nJwiAMv0zpp3WNuRXUClT2r9hPzq5UXzc0+pKwP tsLOm5LGAsfrEFU2qmS+QIKzykKJxhAkCFs+398oTBL+9BUcqGZ5MLrWUAbgLADbFdFV RwWA== X-Gm-Message-State: AOJu0YwmMBYfCKjufulpJHF146S2pexztgkEhqIDkExn25FZC2+OzfXF fcx8PhWSPbO0EO8c63Jrw3o= X-Google-Smtp-Source: AGHT+IG4F5XxYcToamg7FpJygwj+/6L19z0Dr5x+rjKzevN8mYSp2tm/VwGAbfF1LX8f5DzwNk3+lg== X-Received: by 2002:a05:6512:31d5:b0:4fb:81f2:4228 with SMTP id j21-20020a05651231d500b004fb81f24228mr9281728lfe.31.1692112160368; Tue, 15 Aug 2023 08:09:20 -0700 (PDT) Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id e9-20020ac25469000000b004fe4811d382sm2487025lfn.85.2023.08.15.08.09.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2023 08:09:19 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: Re: bug#62092: 30.0.50; "case" does not work as dedenter in Python From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Tue, 15 Aug 2023 17:09:18 +0200 Content-Transfer-Encoding: 7bit Message-Id: References: To: kobarity X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62092 Cc: Lele Gaifax , 62092@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 15 aug. 2023 kl. 15.43 skrev kobarity : > Sorry, I meant to use `should'. Another mistake was forgetting to use > RESTORE-POINT argument when calling `python-tests-look-at'. Attached > is the patch to fix this. It also includes the indentation fix for > `python-info-dedenter-opening-block-positions-6'. Excellent, thank you! Applied to master. From unknown Sat Jun 21 10:43:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 13 Sep 2023 11:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator