[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71170: 30.0.50; hs-hide-all in python mode not works as expected
From: |
kobarity |
Subject: |
bug#71170: 30.0.50; hs-hide-all in python mode not works as expected |
Date: |
Sat, 25 May 2024 23:36:47 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Eli Zaretskii wrote:
>
> > From: lorniu <lorniu@gmail.com>
> > Date: Fri, 24 May 2024 16:40:39 +0800
> >
> >
> > When I run `hs-hide-all` in python mode for some python files,
> > It cannot work properly.
> >
> > For example, the `class` in following code can not be hide:
> >
> > ```
> > if TYPE_CHECKING:
> > Base64FileInput = Union[IO[bytes], PathLike[str]]
> > FileContent = Union[IO[bytes], bytes, PathLike[str]]
> > else:
> > Base64FileInput = Union[IO[bytes], PathLike]
> > FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not
> > subscriptable in Python 3.8.
> >
> > class aaa:
> > ...
> > ```
> >
> > Maybe the issue caused by function in `python-hideshow-find-next-block`
> > of python.el, that the comment regexp should be "^#" instead of "#"?
>
> Shouldn't that be something like "^[:space:]*#" instead?
Hi lorniu,
Thanks for pointing out this issue.
After running `hs-hide-all', the buffer will be like this:
```
if TYPE_CHECKING:...
else:... # PathLike is not subscriptable in Python 3.8.
class aaa:
...
```
As you pointed out, the class aaa is not hidden. However, it is also
a problem that the comment is not hidden.
I think it is better to fix `python-hideshow-forward-sexp-function' to
move the point to the end of the line to include the comment.
Attached is the patch to do that.
0001-Fix-hiding-a-Python-block-ending-with-a-comment.patch
Description: Binary data
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, lorniu, 2024/05/24
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, Eli Zaretskii, 2024/05/25
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected,
kobarity <=
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, lorniu, 2024/05/26
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, kobarity, 2024/05/26
- Message not available
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, kobarity, 2024/05/26
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, lorniu, 2024/05/26
- bug#71170: 30.0.50; hs-hide-all in python mode not works as expected, kobarity, 2024/05/26