all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Pedro" <jpedrodeamorim@gmail.com>
To: 67287@debbugs.gnu.org
Subject: bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp
Date: Sun, 19 Nov 2023 16:35:31 -0300	[thread overview]
Message-ID: <87zfz95yf0.fsf@ergo> (raw)

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)

             reply	other threads:[~2023-11-19 19:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-19 19:35 João Pedro [this message]
2023-11-19 20:18 ` bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp Eli Zaretskii
2023-11-20 13:42   ` João Pedro
2023-11-20 14:10     ` Eli Zaretskii
2023-12-22 14:51   ` Stefan Kangas

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=87zfz95yf0.fsf@ergo \
    --to=jpedrodeamorim@gmail.com \
    --cc=67287@debbugs.gnu.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.