From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#57551: 29.0.50; hide-show in python-mode selects the current block imperfectly Date: Mon, 05 Sep 2022 00:15:40 +0900 Message-ID: References: <87zgfhtqng.fsf@secretsauce.net> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5470"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 57551@debbugs.gnu.org, Lars Ingebrigtsen To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 04 17:16:35 2022 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 1oUrMP-0001AX-25 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Sep 2022 17:16:33 +0200 Original-Received: from localhost ([::1]:35490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUrMO-0002XX-2h for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Sep 2022 11:16:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUrLy-0002Vz-6q for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 11:16:15 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUrLu-0003Ot-GO for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 11:16:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUrLu-0003mH-61 for bug-gnu-emacs@gnu.org; Sun, 04 Sep 2022 11:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Sep 2022 15:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57551 X-GNU-PR-Package: emacs Original-Received: via spool by 57551-submit@debbugs.gnu.org id=B57551.166230455114502 (code B ref 57551); Sun, 04 Sep 2022 15:16:02 +0000 Original-Received: (at 57551) by debbugs.gnu.org; 4 Sep 2022 15:15:51 +0000 Original-Received: from localhost ([127.0.0.1]:45441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUrLj-0003lq-HR for submit@debbugs.gnu.org; Sun, 04 Sep 2022 11:15:51 -0400 Original-Received: from mail-pj1-f42.google.com ([209.85.216.42]:40639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUrLi-0003le-EK for 57551@debbugs.gnu.org; Sun, 04 Sep 2022 11:15:50 -0400 Original-Received: by mail-pj1-f42.google.com with SMTP id t11-20020a17090a510b00b001fac77e9d1fso9931948pjh.5 for <57551@debbugs.gnu.org>; Sun, 04 Sep 2022 08:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date; bh=wILRwOyCa8Epjp0OYsbSgleAkRyzho7pKopurx/1IKo=; b=g6vMWrJ4ih7vPifFggdnkxlAT07Ti979zzWL2gZBIt07SOqSssMMkv9yznPa0e6YKq GyvOcpNOimB7xP7j5sTZjP110KxEusyTbFNGy8KlSceRLEvLKjSJWeN0YAPH51nw70Z9 lZv7Xhrv8E1g2k9/5tvBRqKtw/1JVO6nTL/BU4Tl+rDIQBvhFSlTlAmBxN7aS0b2R9eT 3Pc27lygr1hhHuXJpJ0YjptYpuN6mn7GxMZ5dsUChmOJMX/LWtrvj1Usq8bwAa0Hn4De 2uvoAp4HEBWCBVqUoevN0Q7D6eTvmrFdcGpxwshWW+rwsw52KXU1UW2P8Zr7Y1gsu3Xg eIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=wILRwOyCa8Epjp0OYsbSgleAkRyzho7pKopurx/1IKo=; b=ZtC7ByeeOhME7t8H4G0/1x2w4zktR5l5z/UEy/ZFe1EcC+UEEOGQ7kNDOzHAsbhfFR KMzPo2nfFF5ovTNI1RzIjJ9RXJ4OGsvHVs0E6lWMVyQaf1USLLHVjaO8z0xRkmtKmBxe 2dppJCcTHodWCtrpGnWXYcK90lkDwvAwCsUOrakl7tmafzDZKnPqgmvInCEIuI7EQa3Y 4v7BqvEG6tFmv+C24+j+qT6d0vx6NC5mOV8XykPaK6D0fq/0CKphPu3WW/cvn3gqBwQT GS1GfbNh3wPilwZSVaWBig+Krc+ejz2GLUGwrKmlS01dmaAPdHajnMzsJqRedKbtHm/V O4PA== X-Gm-Message-State: ACgBeo0hVhuxCGvWa21qbNERcEcuhrqp5PO6NchngPiMWvOqMdDjObUQ nD5tYSE0Fi+fWxyArpwBQGVfgiIoZFQtRg== X-Google-Smtp-Source: AA6agR6SQI4Ht0V3owRYwa2e+RPjjilpxrbWgQyXpUaxfNj/SpPsAyQkczHpCrb1VgYV17Z+SMvSkw== X-Received: by 2002:a17:903:247:b0:16c:5017:9ad4 with SMTP id j7-20020a170903024700b0016c50179ad4mr46329073plh.115.1662304544487; Sun, 04 Sep 2022 08:15:44 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id s62-20020a625e41000000b005350ea966c7sm5699642pfb.154.2022.09.04.08.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Sep 2022 08:15:43 -0700 (PDT) In-Reply-To: <87zgfhtqng.fsf@secretsauce.net> 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:241507 Archived-At: Dima Kogan wrote: > But what if the point is at the start of the "elif 2:" line? Currently > emacs considers this to be INSIDE this block also, so (hs-hide-block) > there also hides the "elif 2" block, but should it? Would it not make > more sense if the START of the "elif 2:" line was considered in the "def > f():" block, but outside all the "if" blocks? Then (hs-hide-block) at > the start of that line would collapse the whole "def f():" block. > Currently the only point where this can be done is at the end of the > "def f():" line. Hi. I think current hideshow behavior is in line with block navigation in Python mode. For example, if the point is at the start of the "elif 2:" line, M-x python-nav-beginning-of-block moves the point to "e" of "elif 2:". This implies that Emacs Python mode considers spaces before "elif 2:" to belong to the "elif 2:" block. So I think this is not a matter of hideshow, but of how the block should be recognized. The current implementation seems to assume that the block boundary is always at the end of the line, as shown in the following figure. _______________ |def f(): | |_____________ | || if 1: || ||________11__|| || elif 2: || ||________22__|| |______________| On the other hand, Dima seems to expect the block boundary to be as shown in the following figure. _______________ |def f(): | | _________ | | ___|if 1: _|| ||_______ 11|_ | | ___|elif 2:_|| ||_______ 22| | |______________| Although both models may have pros and cons, the current implementation seems more natural to me. In particular, it would be more natural for "elif" or "else" block to be adjacent to "if" block with nothing else in between. Regards,