all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: kobarity <kobarity@gmail.com>
Cc: 52092@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	Mohammed Sadiq <sadiq@sadiqpk.org>
Subject: bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded
Date: Fri, 23 Sep 2022 18:01:05 -0400	[thread overview]
Message-ID: <jwvv8pdiwuw.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <eke71qs727tv.wl-kobarity@gmail.com> (kobarity@gmail.com's message of "Mon, 19 Sep 2022 15:31:56 +0900")

> 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	other threads:[~2022-09-23 22:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  7:40 bug#52092: 28.0.60; hs-toggle-hiding does not toggle once folded Mohammed Sadiq
2021-11-25 10:29 ` Eli Zaretskii
2022-09-19  6:31 ` kobarity
2022-09-23 22:01   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-09-24  5:59     ` kobarity
2022-09-24 15:10       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-25  2:26         ` kobarity
2022-09-24  6:17     ` Eli Zaretskii
2022-09-24 15:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvv8pdiwuw.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=52092@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=kobarity@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=sadiq@sadiqpk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.