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.
Full log
View this message in rfc822 format
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.
This bug report was last modified 1 year and 203 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.