GNU bug report logs -
#67287
29.1; hs-set-up-overlay messes up indent-sexp
Previous Next
Reported by: João Pedro <jpedrodeamorim <at> gmail.com>
Date: Sun, 19 Nov 2023 19:36:01 UTC
Severity: normal
Tags: notabug, wontfix
Found in version 29.1
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67287 in the body.
You can then email your comments to 67287 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#67287
; Package
emacs
.
(Sun, 19 Nov 2023 19:36:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
João Pedro <jpedrodeamorim <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 19 Nov 2023 19:36:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#67287
; Package
emacs
.
(Sun, 19 Nov 2023 20:20:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 67287 <at> debbugs.gnu.org (full text, mbox):
tags 67287 notabug wontfix
thanks
> From: João Pedro <jpedrodeamorim <at> 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.
Added tag(s) wontfix and notabug.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 19 Nov 2023 20:20:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#67287
; Package
emacs
.
(Mon, 20 Nov 2023 13:43:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 67287 <at> debbugs.gnu.org (full text, mbox):
Em domingo, 19/11/2023 às 22:18, Eli Zaretskii <eliz <at> 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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#67287
; Package
emacs
.
(Mon, 20 Nov 2023 14:11:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 67287 <at> debbugs.gnu.org (full text, mbox):
> From: João Pedro <jpedrodeamorim <at> gmail.com>
> Cc: 67287 <at> 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.
Reply sent
to
Stefan Kangas <stefankangas <at> gmail.com>
:
You have taken responsibility.
(Fri, 22 Dec 2023 14:52:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
João Pedro <jpedrodeamorim <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 22 Dec 2023 14:52:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 67287-done <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> This is not a bug.
I'm therefore closing this bug report.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 20 Jan 2024 12:24:23 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 112 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.