From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67287: 29.1; hs-set-up-overlay messes up indent-sexp Date: Sun, 19 Nov 2023 22:18:38 +0200 Message-ID: <83a5r9jy3l.fsf@gnu.org> References: <87zfz95yf0.fsf@ergo> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34835"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67287@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o?= Pedro Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 19 21:20:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r4oH7-0008pC-8i for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Nov 2023 21:20:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4oGv-0003Bc-RX; Sun, 19 Nov 2023 15:20:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4oGu-0003B7-OU for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 15:20:00 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4oGu-0000FS-Gs for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 15:20:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4oGw-0002yM-2E for bug-gnu-emacs@gnu.org; Sun, 19 Nov 2023 15:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Nov 2023 20:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67287 X-GNU-PR-Package: emacs Original-Received: via spool by 67287-submit@debbugs.gnu.org id=B67287.170042514511319 (code B ref 67287); Sun, 19 Nov 2023 20:20:02 +0000 Original-Received: (at 67287) by debbugs.gnu.org; 19 Nov 2023 20:19:05 +0000 Original-Received: from localhost ([127.0.0.1]:52160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4oG0-0002wS-V0 for submit@debbugs.gnu.org; Sun, 19 Nov 2023 15:19:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4oFz-0002vu-4s; Sun, 19 Nov 2023 15:19:03 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4oFs-00009O-1K; Sun, 19 Nov 2023 15:18:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=mRAn91QT4z3z+Aa8U7KUbsMzS6pHa3mIU+ilOHbqtaM=; b=SKMMtLim//iPnpUvD+mz 2f9n/sXWlOImREV4tyIJa2RQCNLhKlJkcjPSmm/L2BamXfKHeOU0gRVZNB4zn8NSA2iUIb9vwDrYQ zi3wESL4gJLJbhXrtPo0ire76pMmw5GN9lJsbv/pxO2wIOpI92G0tbpm+qQsSNBwAvrjHBDyhWXne EzgdFZxHPWf9HRunGzqG+7kvqvqLT75Y6dVtoR7QpcPo1DXXVXSajKxBNFglkcn8kROsVv3GPtEv9 nyUjnCpSMChhRpwqmhlheBeuZw+TaKJcpt0mxWqrrvUxIIENhBJQ5oRc5o4HpPHVrJF51bLiQ+Q7a YJcXZb/jyQngjA==; In-Reply-To: <87zfz95yf0.fsf@ergo> (message from =?UTF-8?Q?Jo=C3=A3o?= Pedro on Sun, 19 Nov 2023 16:35:31 -0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274637 Archived-At: tags 67287 notabug wontfix thanks > From: João Pedro > 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.