GNU bug report logs -
#56635
29.0.50; [PATCH] hide-show in python-mode supports ONLY function and class blocks
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Mon, 18 Jul 2022 22:21:01 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 56635 <at> debbugs.gnu.org (full text, mbox):
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 <kobarity <at> gmail.com> wrote:
> Hi,
>
> Dima Kogan <dima <at> secretsauce.net> 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,
This bug report was last modified 2 years and 266 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.