GNU bug report logs - #52092
28.0.60; hs-toggle-hiding does not toggle once folded

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Thu, 25 Nov 2021 07:42:01 UTC

Severity: normal

Tags: help

Found in version 28.0.60

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 52092 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: kobarity <kobarity <at> gmail.com>
Cc: 52092 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Mohammed Sadiq <sadiq <at> sadiqpk.org>
Subject: Re: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded
Date: Fri, 23 Sep 2022 18:01:05 -0400
> 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)





This bug report was last modified 2 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.