From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#56635: 29.0.50; [PATCH] hide-show in python-mode supports ONLY function and class blocks Date: Mon, 08 Aug 2022 17:16:02 +0200 Message-ID: <878rnyg40d.fsf@gmail.com> References: <87v8ruysep.fsf@secretsauce.net> <87zgh01cqm.fsf@gnus.org> <87sfmr5zi9.fsf@secretsauce.net> <87wnbt3vnq.fsf@secretsauce.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22511"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , Dima Kogan , 56635@debbugs.gnu.org To: kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 08 17:17:17 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 1oL4VI-0005d0-MA for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Aug 2022 17:17:16 +0200 Original-Received: from localhost ([::1]:52956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oL4VH-0007Yt-Jd for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Aug 2022 11:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL4V4-0007Yk-JQ for bug-gnu-emacs@gnu.org; Mon, 08 Aug 2022 11:17:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oL4V4-0008K6-8T for bug-gnu-emacs@gnu.org; Mon, 08 Aug 2022 11:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oL4V4-0005Bp-2F for bug-gnu-emacs@gnu.org; Mon, 08 Aug 2022 11:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Aug 2022 15:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56635 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 56635-submit@debbugs.gnu.org id=B56635.165997177219890 (code B ref 56635); Mon, 08 Aug 2022 15:17:02 +0000 Original-Received: (at 56635) by debbugs.gnu.org; 8 Aug 2022 15:16:12 +0000 Original-Received: from localhost ([127.0.0.1]:41544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL4UG-0005Ak-7I for submit@debbugs.gnu.org; Mon, 08 Aug 2022 11:16:12 -0400 Original-Received: from mail-ej1-f46.google.com ([209.85.218.46]:41850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL4UE-0005AX-Q7 for 56635@debbugs.gnu.org; Mon, 08 Aug 2022 11:16:11 -0400 Original-Received: by mail-ej1-f46.google.com with SMTP id gk3so17161486ejb.8 for <56635@debbugs.gnu.org>; Mon, 08 Aug 2022 08:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=tUVo3QYIZY03nNWbRj5Yvjpa7CrVPc8Ay5Grt1kyNiw=; b=dekDCZb3Wy2LZ1XZKEDHiLlgGhg3u0nwCP0UgeT6/rkCIko6/nG9w9uAD6I1QYqGDf eMUzUGHOZKLvEwQwUiDU/Ln3kcZZUrypTDqaaqW8H2MgwV3bN0wphyhsbL8rUAZltNJI byfqODtyLEdM/DnjNTYLaQ0AJ+07unKyCwvPKo6m7g1EdTdkBjuC7n2qpVPCF73xS+xp rtiyLZ4RGX8kmQHODguLsr724UieKthubjQEbdKaXTIRsRL45LrmrAtQ8/F3cyvsX/C3 KFGfdJn/4fap83VCoXOk3ft8Zi8j6Ju0PbBtboYxob1Aa/GneFU69iPSuHREFYR7cWoJ V9yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=tUVo3QYIZY03nNWbRj5Yvjpa7CrVPc8Ay5Grt1kyNiw=; b=nWmiHOkkXcN8cpTg68cR8nWaRds9ZYK+fb1/2wcXH4SPGIFF/1qCzN1fd+kMKkpANG TjKTp+r4IbEVnNPmf3FrnF/Wlc+Nfgg+RqsbvobmR/6zjMlTCo7hyGmlcWDQWC9EHMPX i1+nC/lFE2ljEospaDsHMVEaFKyybw6gXwMSYQbTlqR2E9puG9phqcHeSSSudX2Lwote AngdPjjkNpiYj0WVdTzwVEhS4p3AuNvavMYZlFFgQys1tKQ5C20iYrIUHeEQnrenr5Iw 2uDmGXUSOAK/doQDckQcZ8Arfq7R6Ikqd/nnZLPn9awqEBzm8nUTjhMMX+GW3n+Yh3YK saIA== X-Gm-Message-State: ACgBeo0kHoPE2H5dFz6rZdWEDYlbyJAnYIMwG6RJZJI5a78wGDQcVIcy bQqYHpyZbjV/pBYZ9ITrlDkqrrq5Y0Y= X-Google-Smtp-Source: AA6agR5h+z2nHPkHAVadLEID0uRoMhfxDRaK8GGBsW7BVzOYamA9V0DxWpQnmeFiXl+mO639wNyJVw== X-Received: by 2002:a17:907:7254:b0:731:61c6:ecf9 with SMTP id ds20-20020a170907725400b0073161c6ecf9mr3373663ejc.101.1659971764545; Mon, 08 Aug 2022 08:16:04 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::dc4d]) by smtp.gmail.com with ESMTPSA id p25-20020a17090653d900b007310a9ae436sm3925668ejo.112.2022.08.08.08.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 08:16:03 -0700 (PDT) In-Reply-To: (kobarity@gmail.com's message of "Sun, 7 Aug 2022 23:37:59 +0900") 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:239123 Archived-At: This is a marginally related remark, but I noticed that python-mode sets (setq-local outline-heading-end-regexp ":[^\n]*\n") and this doesn't work well with the new-ish type annotation syntax. Wouldn't it be better to simply remove this setting, reverting back to the default "\n"? Then folding by outline-minor-mode would behave like hideshow currently does when it comes to something like def f( x: int ) -> int: pass On Sun, 7 Aug 2022 at 23:37, kobarity wrote: > Hi, > > Dima Kogan wrote: >> I do agree that the best thing to do is to use functions instead of pure >> regexes here. Can we hook that into hs-special-modes-alist instead of >> doing something specific in python-mode? I'm imagining extending the >> meaning of the fields in hs-special-modes-alist, where we'd do something >> different, depending on if some element is a string or not. Maybe that >> would make it easier to extend the hideshow support for other languages? > > If we are to extend hs-special-modes-alist, I think it's better to add > functions to find/check blocks. Maybe this is the third option > mentioned in the first mail. For that, I added three functions to > hs-special-modes-alist: > > - hs-find-block-beginning-func > - hs-find-next-block-func > - hs-looking-at-block-start-p-func > > Attached is a prototype patch to achieve this. > > Regards,