* bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
@ 2023-11-19 19:35 João Pedro
2023-11-19 20:18 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: João Pedro @ 2023-11-19 19:35 UTC (permalink / raw)
To: 67287
Greetings!
When setting `hs-set-up-overlay' to a custom value, such as the one in
the docstring for the variable, it messes up the behaviour of
`indent-sexp' when it is called "before" the s-expression.
Steps to reproduce:
1. Go to any lisp buffer e.g. *scracth*
2. Paste the following piece of code
(setq hs-set-up-overlay
(lambda (ov)
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'display
(propertize
(format " ... <%d>"
(count-lines (overlay-start ov)
(overlay-end ov)))
'face 'font-lock-type-face)))))
3. Evaluate it
4. Enable `hs-minor-mode'
5. Hide the block with `hs-hide-block' (need to be on the beginning line
of the forms)
6. Move point either to the first opening parenthesis or the the empty
line before the `setq' form
(setq
^----
7. Call `indent-sexp'
8. Open the block with `hs-show-block'
You should see the following:
(setq hs-set-up-overlay
(lambda (ov)
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'display
(propertize
(format " ... <%d>"
(count-lines (overlay-start ov)
(overlay-end ov)))
)
I tried to investigate why it does that, but couldn't really get to the
root cause. It seems that its only affected when we're setting the
`display' prop of the overlay, but I couldn't confirm it either.
Best regards,
--
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
2023-11-19 19:35 bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp João Pedro
@ 2023-11-19 20:18 ` Eli Zaretskii
2023-11-20 13:42 ` João Pedro
2023-12-22 14:51 ` Stefan Kangas
0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-11-19 20:18 UTC (permalink / raw)
To: João Pedro; +Cc: 67287
tags 67287 notabug wontfix
thanks
> From: João Pedro <jpedrodeamorim@gmail.com>
> Date: Sun, 19 Nov 2023 16:35:31 -0300
>
> When setting `hs-set-up-overlay' to a custom value, such as the one in
> the docstring for the variable, it messes up the behaviour of
> `indent-sexp' when it is called "before" the s-expression.
>
> Steps to reproduce:
>
> 1. Go to any lisp buffer e.g. *scracth*
> 2. Paste the following piece of code
>
> (setq hs-set-up-overlay
> (lambda (ov)
> (when (eq 'code (overlay-get ov 'hs))
> (overlay-put ov 'display
> (propertize
> (format " ... <%d>"
> (count-lines (overlay-start ov)
> (overlay-end ov)))
> 'face 'font-lock-type-face)))))
>
> 3. Evaluate it
> 4. Enable `hs-minor-mode'
> 5. Hide the block with `hs-hide-block' (need to be on the beginning line
> of the forms)
> 6. Move point either to the first opening parenthesis or the the empty
> line before the `setq' form
>
> (setq
> ^----
>
> 7. Call `indent-sexp'
> 8. Open the block with `hs-show-block'
>
> You should see the following:
>
> (setq hs-set-up-overlay
> (lambda (ov)
> (when (eq 'code (overlay-get ov 'hs))
> (overlay-put ov 'display
> (propertize
> (format " ... <%d>"
> (count-lines (overlay-start ov)
> (overlay-end ov)))
> )
>
> I tried to investigate why it does that, but couldn't really get to the
> root cause. It seems that its only affected when we're setting the
> `display' prop of the overlay, but I couldn't confirm it either.
Indentation commands align text by columns, and 'display' properties
and invisible text affect those columns (starting from Emacs 29). So
you shouldn't expect reasonable results from indenting a sexp which is
partially hidden and has a 'display' property that replaces it. IOW,
always unhide the block before indenting it.
This is not a bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
2023-11-19 20:18 ` Eli Zaretskii
@ 2023-11-20 13:42 ` João Pedro
2023-11-20 14:10 ` Eli Zaretskii
2023-12-22 14:51 ` Stefan Kangas
1 sibling, 1 reply; 5+ messages in thread
From: João Pedro @ 2023-11-20 13:42 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 67287
Em domingo, 19/11/2023 às 22:18, Eli Zaretskii <eliz@gnu.org> escreveu:
Hey Eli, thanks for the quick reply.
> Indentation commands align text by columns, and 'display' properties
> and invisible text affect those columns (starting from Emacs 29).
Ah, that explains why I started seeing this behaviour recently...
> So you shouldn't expect reasonable results from indenting a sexp which
> is partially hidden and has a 'display' property that replaces it.
> IOW, always unhide the block before indenting it.
So you mean that whatever is going to indent or modify the hidden text
should be "unhiding" it before doing so? Can you point to a function
that does this so I could take as a reference?
> This is not a bug.
Yeah, but maybe it requires a bit more documenting? I couldn't find
where this new behaviour was documented in NEWS.29, all I could find was
that the implementation of overlays has changed, but no mention of how
it affects 'display' properties. Maybe I missed it?
Regards,
--
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
2023-11-20 13:42 ` João Pedro
@ 2023-11-20 14:10 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-11-20 14:10 UTC (permalink / raw)
To: João Pedro; +Cc: 67287
> From: João Pedro <jpedrodeamorim@gmail.com>
> Cc: 67287@debbugs.gnu.org
> Date: Mon, 20 Nov 2023 10:42:24 -0300
>
> > So you shouldn't expect reasonable results from indenting a sexp which
> > is partially hidden and has a 'display' property that replaces it.
> > IOW, always unhide the block before indenting it.
>
> So you mean that whatever is going to indent or modify the hidden text
> should be "unhiding" it before doing so? Can you point to a function
> that does this so I could take as a reference?
Not sure what you want me to tell. I meant hs-show-block and its
likes.
> > This is not a bug.
>
> Yeah, but maybe it requires a bit more documenting? I couldn't find
> where this new behaviour was documented in NEWS.29, all I could find was
> that the implementation of overlays has changed, but no mention of how
> it affects 'display' properties. Maybe I missed it?
It was deemed to be a bug fix, since current-column would basically
ignore these features and behave as if display properties didn't
exist. And we don't call out bug fixes in NEWS.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
2023-11-19 20:18 ` Eli Zaretskii
2023-11-20 13:42 ` João Pedro
@ 2023-12-22 14:51 ` Stefan Kangas
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2023-12-22 14:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: João Pedro, 67287-done
Eli Zaretskii <eliz@gnu.org> writes:
> This is not a bug.
I'm therefore closing this bug report.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-22 14:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-19 19:35 bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp João Pedro
2023-11-19 20:18 ` Eli Zaretskii
2023-11-20 13:42 ` João Pedro
2023-11-20 14:10 ` Eli Zaretskii
2023-12-22 14:51 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).