bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Sun, 26 May 2024 14:10:35 +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)

lorniu wrote:
> 
> 
> Maybe patch like this can avoid too much newlines between hidden blocks.
> 
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 79e383a1c1a..26546df13c4 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -5734,7 +5734,12 @@ python-describe-at-point
>  (defun python-hideshow-forward-sexp-function (_arg)
>    "Python specific `forward-sexp' function for `hs-minor-mode'.
>  Argument ARG is ignored."
> -  (python-nav-end-of-block))
> +  (python-nav-end-of-block)
> +  (end-of-line)
> +  (let ((pt (point)))
> +    (skip-chars-forward " \n\t")
> +    (re-search-backward "\n\n" nil t)
> +    (when (< (point) pt) (goto-char pt))))
> 
> -- 
> Mess.

It seems this patch hides like this:

```
   if TYPE_CHECKING:...else:...

   class aaa:...
```

Is this what you want?  I think it is overkill to put if and else on
one line.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]