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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded


From: Stefan Monnier
Subject: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded
Date: Fri, 23 Sep 2022 18:01:05 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> 1. emacs -Q
> 2. Open the following C mode file.
> 
> #+begin_src C
> int
> main() {
>   sub();
> }
> 
> int
> sub() {
>   printf("sub\n");
> }
> #+end_src
> 
> 3. M-x hs-minor-mode
> 4. Move the point to the "printf" line in the "sub" function.
> 5. Shift mouse-2 in the function "main".
>    The function body of "sub" is hidden instead of "main".  This is
>    not I expected.

Hmm... indeed it's a trivial oversight in my patch, sorry.
The patch below should fix it.

> (posn-set-point (event-end e)) was added to `hs-toggle-hiding' by this
> commit.  This is the main cause of bug#52092.

Indeed, thanks.

I had no idea that (posn-point (posn-at-point POS)) doesn't return POS
if POS is within an invisible chunk of text and instead returns the next
visible position.

I'll have to think about how best to fix the consequence.


        Stefan


diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index c0796fc2eeb..8dd8c7e182c 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -948,7 +948,7 @@ hs-toggle-hiding
   "Toggle hiding/showing of a block.
 See `hs-hide-block' and `hs-show-block'.
 Argument E should be the event that triggered this action."
-  (interactive)
+  (interactive (list last-nonmenu-event))
   (hs-life-goes-on
    (posn-set-point (event-end e))
    (if (hs-already-hidden-p)






reply via email to

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