GNU bug report logs - #79294
[PATCH] Add hideable indicators for hideshow.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Sat, 23 Aug 2025 04:57:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79294 <at> debbugs.gnu.org
Subject: bug#79294: [PATCH] Add hideable indicators for hideshow.
Date: Sun, 14 Sep 2025 19:50:02 -0600
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> +@item hs-show-indicators
>> +This variable controls whether Hideshow mode should display indicators
>> +of hidden and shown blocks.  The indicators also allow toggling the
>> +hide/show state of each block. If the value is non-@code{nil}, enables
>> +the indicators in all blocks except comment blocks.  The default is
>> +@code{nil}, which disables the indicators.
>
> You don't mention the value include-comments here.  It's okay not to
> mention it for brevity, but t6hen we should not say "all blocks except
> comment blocks", just that non-nil shows them and nil doesn't.

I removed the include-comments value from the code, so this mean that
the indicators will not be enabled in comment blocks, that's why I had
to specify it.

I've already updated that part.

[...]


>> +*** New user option 'hs-indicators-type'.
>> +This user option determine which indicator type should be used for the
>> +block indicators.
>> +
>> +The possible values can be: 'left-fringe', display the indicators in the
>> +left fringe (the default); 'right-fringe', display the indicators in the
>> +right fringe; 'left-margin', display the indicators in the left margin;
>> +'right-margin', display the indicators in the right margin; nil, display
>> +a string as indicator after the block beginning.
>
> This needs to be updated, since the values are now different.

Thanks i forgot to update it.

> And the doc string should also explain:
>
>   . what do you mean by "block positions" -- is it a list of positions?
>   . what is the significance and the role of the starting position
>   . where does the function start if BEG is nil or omitted

Thanks, I've updated it.

The BEG argument was intended for internal use only, and I forgot to
remove it.

>> +  (let* ((o (make-overlay
>> +             ;; FIXME: The mouse-1 event doesn't work well for fringes,
>> +             ;; a workaround for this is set the overlay at the
>> +             ;; beginning of the line only for fringe indicators
>> +             (if (eq hs-indicator-type 'fringe) (pos-bol) beg)
>> +             (1+ beg)))
>
> What doesn't work well in mouse-1 clicks on the fringes?

Apparently the fringe keymap does not work if the overlay is not created
from BOL:

e.g.

The mouse-1 clicks works for this since it is created at BOL:

#+begin_src elisp
|+| (defvar-local var nil
| |  "Docstring.")
#+end_src

But for code blocks that are not at BOL this will not work:

#+begin_src elisp
|+| (defvar-local var ; <- This works
|+|   (when foo ; <- This does not
| |     (bar))
| |  "Docstring.")
#+end_src

I have added a new alternative in the patch, and for the moment, it
should work well for fringes.

[0001-Add-hideable-indicators-for-hideshow.-Bug-79294.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
--
- E.G via Gnus and Org.

This bug report was last modified 3 days ago.

Previous Next


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