From unknown Wed Jun 18 23:13:21 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#60692 <60692@debbugs.gnu.org> To: bug#60692 <60692@debbugs.gnu.org> Subject: Status: 29.0.60; current-indentation wrong without outline ellipsis Reply-To: bug#60692 <60692@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:13:21 +0000 retitle 60692 29.0.60; current-indentation wrong without outline ellipsis reassign 60692 emacs submitter 60692 Juri Linkov severity 60692 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 09 12:35:40 2023 Received: (at submit) by debbugs.gnu.org; 9 Jan 2023 17:35:40 +0000 Received: from localhost ([127.0.0.1]:38097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEw3g-0004Dv-1m for submit@debbugs.gnu.org; Mon, 09 Jan 2023 12:35:40 -0500 Received: from lists.gnu.org ([209.51.188.17]:33528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEw3e-0004Dn-0Z for submit@debbugs.gnu.org; Mon, 09 Jan 2023 12:35:38 -0500 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 1pEw3R-0007M8-2k for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2023 12:35:36 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEw3N-0005JQ-Ur for bug-gnu-emacs@gnu.org; Mon, 09 Jan 2023 12:35:24 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 9BA71C0009 for ; Mon, 9 Jan 2023 17:35:19 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 29.0.60; current-indentation wrong without outline ellipsis Organization: LINKOV.NET Date: Mon, 09 Jan 2023 19:34:07 +0200 Message-ID: <86k01v1y9c.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.183.198; envelope-from=juri@linkov.net; helo=relay6-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) When there is an outline ellipsis displayed at the end of outline headings, then the correct indentation 2 is returned in this test case: (progn (switch-to-buffer (get-buffer-create "test1")) (insert "* h\n .\n") (outline-mode) (outline-hide-sublevels 1) (goto-char 8) (current-indentation)) But when the ellipsis is disabled with invisibility-spec: (progn (switch-to-buffer (get-buffer-create "test2")) (insert "* h\n .\n") (outline-mode) (remove-from-invisibility-spec '(outline . t)) (add-to-invisibility-spec 'outline) (outline-hide-sublevels 1) (goto-char 8) (current-indentation)) then the returned indentation is 0 that is incorrect. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 09 13:34:42 2023 Received: (at 60692) by debbugs.gnu.org; 9 Jan 2023 18:34:42 +0000 Received: from localhost ([127.0.0.1]:38159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEwyo-0005kT-GU for submit@debbugs.gnu.org; Mon, 09 Jan 2023 13:34:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:32940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEwym-0005kF-R6 for 60692@debbugs.gnu.org; Mon, 09 Jan 2023 13:34:41 -0500 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 1pEwyZ-0006ja-6M; Mon, 09 Jan 2023 13:34:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VMIIUAM5on/nkxzDC9loZ2vCYRpTlWuKyAP12sMc/x8=; b=Bb+rG9+IKCcw k3qKmkhhxLUuRRWkqqehpk/SleKvj0vNwiHTMfuMdmWQRx2So0X5xFkjVBGykw8nYpzpdGYUz9p1B AZ/psC0S+Oy6HtPOAsfolznUE/LlfT3oOIir4kwKlWcOhuhcljpjd4nPebM3531uTp6weaJTmbWXY kABd54Ftja8tXgUTIruNE3yAO26ecXa5fVynBjRSZeGM4pDWQRwNniwThQ8661tmRZBtUfOOrX7Y+ lIBTCMCz8jQ9JvOdKIv6nL59oMgzc2zYOL0qlihinMQluRGkwvBI7yvF1gWHNbyqEY3sO8xsVFU4b kbKJ+MdG5UCfc482QfVTtg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEwyX-0002VW-6C; Mon, 09 Jan 2023 13:34:26 -0500 Date: Mon, 09 Jan 2023 20:34:50 +0200 Message-Id: <83wn5vo8tx.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86k01v1y9c.fsf@mail.linkov.net> (message from Juri Linkov on Mon, 09 Jan 2023 19:34:07 +0200) Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis References: <86k01v1y9c.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Juri Linkov > Date: Mon, 09 Jan 2023 19:34:07 +0200 > > When there is an outline ellipsis displayed at the end of outline headings, > then the correct indentation 2 is returned in this test case: > > (progn > (switch-to-buffer (get-buffer-create "test1")) > (insert "* h\n .\n") > (outline-mode) > (outline-hide-sublevels 1) > (goto-char 8) > (current-indentation)) How is 2 correct in this case? I'd expect 6. 2 is correct when point is on 'h'. > But when the ellipsis is disabled with invisibility-spec: > > (progn > (switch-to-buffer (get-buffer-create "test2")) > (insert "* h\n .\n") > (outline-mode) > (remove-from-invisibility-spec '(outline . t)) > (add-to-invisibility-spec 'outline) > (outline-hide-sublevels 1) > (goto-char 8) > (current-indentation)) > > then the returned indentation is 0 that is incorrect. I think they are both incorrect, because the algorithm in current-indentation doesn't expect that the current line is entirely made of invisible text. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 09 14:10:10 2023 Received: (at 60692) by debbugs.gnu.org; 9 Jan 2023 19:10:10 +0000 Received: from localhost ([127.0.0.1]:38192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pExX8-0006lC-Et for submit@debbugs.gnu.org; Mon, 09 Jan 2023 14:10:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pExX6-0006ky-LZ for 60692@debbugs.gnu.org; Mon, 09 Jan 2023 14:10:09 -0500 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 1pExX1-0004bF-1c; Mon, 09 Jan 2023 14:10:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ujpLI6J/if7U6iKwWhhgFMOYebWA5YhyjizjZPQTdek=; b=QPABF0CVCRth Hm1N+5kAreAOeA8C5WJoCCbjeQRn3o5rW8TzW5OTTemGSFPhIt085dzN1k60+SbecSNoC3fqdR7eq 5bE/UQgWWq7I7FLrsqHGO+Tb7DbVS1LfpwnriP6TTaBmV66Qgs0ArHVRHbsLe4MiGvmbNaWM3gf7X 7sH4B/hxIiR9Eng9j/WRPGgMgxbhwezglw1UR5D/MtHpkbUquFGrqo5qFNdMM/J5ZKm8hRtLjuJH/ UuuZX+3UrYCL6mvrSuEDRnMu3jJZN4ip4hZRBIWchYSo5stoAnn3SndEnnjVh5X29NPoz01z/ebRL 1BIrdySBB3qoWTGwjNgGew==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pExX0-0006eD-Gg; Mon, 09 Jan 2023 14:10:02 -0500 Date: Mon, 09 Jan 2023 21:10:28 +0200 Message-Id: <83tu0zo76j.fsf@gnu.org> From: Eli Zaretskii To: juri@linkov.net In-Reply-To: <83wn5vo8tx.fsf@gnu.org> (message from Eli Zaretskii on Mon, 09 Jan 2023 20:34:50 +0200) Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis References: <86k01v1y9c.fsf@mail.linkov.net> <83wn5vo8tx.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60692@debbugs.gnu.org > Date: Mon, 09 Jan 2023 20:34:50 +0200 > From: Eli Zaretskii > > > From: Juri Linkov > > Date: Mon, 09 Jan 2023 19:34:07 +0200 > > > > When there is an outline ellipsis displayed at the end of outline headings, > > then the correct indentation 2 is returned in this test case: > > > > (progn > > (switch-to-buffer (get-buffer-create "test1")) > > (insert "* h\n .\n") > > (outline-mode) > > (outline-hide-sublevels 1) > > (goto-char 8) > > (current-indentation)) > > How is 2 correct in this case? I'd expect 6. 2 is correct when point > is on 'h'. Sorry, I was confused. I thought we were talking about current-column. About current-indentation: it skips invisible text, so it's unclear to me why you expected to see 2. The doc string says: Text that has an invisible property is considered as having width 0, unless `buffer-invisibility-spec' specifies that it is replaced by an ellipsis. The "current indentation" on the line of buffer position 8 is entirely in invisible text, and current-indentation only accounts for _visible_ whitespace, per the above documentation. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 10 03:25:46 2023 Received: (at 60692) by debbugs.gnu.org; 10 Jan 2023 08:25:47 +0000 Received: from localhost ([127.0.0.1]:38707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pF9x4-0004dq-KX for submit@debbugs.gnu.org; Tue, 10 Jan 2023 03:25:46 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:58587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pF9x3-0004dO-0U; Tue, 10 Jan 2023 03:25:45 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id AFC96C0007; Tue, 10 Jan 2023 08:25:36 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis In-Reply-To: <83tu0zo76j.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 09 Jan 2023 21:10:28 +0200") Organization: LINKOV.NET References: <86k01v1y9c.fsf@mail.linkov.net> <83wn5vo8tx.fsf@gnu.org> <83tu0zo76j.fsf@gnu.org> Date: Tue, 10 Jan 2023 10:20:20 +0200 Message-ID: <86k01ulrwl.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) forcemerge 56837 60692 thanks > About current-indentation: it skips invisible text, so it's unclear to > me why you expected to see 2. The doc string says: > > Text that has an invisible property is considered as having width 0, unless > `buffer-invisibility-spec' specifies that it is replaced by an ellipsis. > > The "current indentation" on the line of buffer position 8 is entirely > in invisible text, and current-indentation only accounts for _visible_ > whitespace, per the above documentation. Thanks for the reference, it explains the problem. But this is a very strange logic. I don't get it. Why it depends on the presence of the ellipsis and fails without it? Now I see this bug report is a duplicate of bug#56837. This is a problem because modes use 'current-indentation' to get an outline level in 'outline-level' function, e.g. (setq-local outline-level (lambda () "`outline-level' function for Python mode." (1+ (/ (current-indentation) python-indent-offset)))) (setq-local outline-level (lambda () (1+ (/ (current-indentation) ruby-indent-level)))) But this fails when users want to remove an ellipsis. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 10 08:28:43 2023 Received: (at 60692) by debbugs.gnu.org; 10 Jan 2023 13:28:43 +0000 Received: from localhost ([127.0.0.1]:39141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFEgF-0005TC-0L for submit@debbugs.gnu.org; Tue, 10 Jan 2023 08:28:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFEgE-0005Sw-0O for 60692@debbugs.gnu.org; Tue, 10 Jan 2023 08:28:42 -0500 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 1pFEg8-0003nw-Da; Tue, 10 Jan 2023 08:28:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=y4zjme6ag6uy9QNXawzOZHOpNhqjytINSqHHMsd3des=; b=rkXL/jt4P2yw 7528FcX49XyUId9IQqq11a8VlfUvCkzzhaDNweQxmZ1tCqbj0k4BbeshBHrxOmmtL3Jwbe9z0GDJP yVa6vUSqB9ObuL5G0GR6nCg1HVyOEVAsglb5F1JaDbIAigvKjSEPbIcc5X6c7OQ4jd2hXBoK8ELuf YQECb5O3RCOK88rZ57arEWchJgxYTv2E9n3IQ1tWDJ9/QZ0wdfvbFgxdAV78OkaxoVfy0TBYpQX+9 p9Ocq+4yOmlJMaLlQRb2dA9AiKomiPKxpAkBXZUIfwCQ9k3nG42gXK6ZHYlVsJManzoPj3qP1xBDc IL/MhnUolVI0wE+EyLqQlA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFEg3-0004gD-74; Tue, 10 Jan 2023 08:28:35 -0500 Date: Tue, 10 Jan 2023 15:29:00 +0200 Message-Id: <838riao6w3.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86k01ulrwl.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 10 Jan 2023 10:20:20 +0200) Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis References: <86k01v1y9c.fsf@mail.linkov.net> <83wn5vo8tx.fsf@gnu.org> <83tu0zo76j.fsf@gnu.org> <86k01ulrwl.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Juri Linkov > Cc: 60692@debbugs.gnu.org > Date: Tue, 10 Jan 2023 10:20:20 +0200 > > forcemerge 56837 60692 > thanks > > > About current-indentation: it skips invisible text, so it's unclear to > > me why you expected to see 2. The doc string says: > > > > Text that has an invisible property is considered as having width 0, unless > > `buffer-invisibility-spec' specifies that it is replaced by an ellipsis. > > > > The "current indentation" on the line of buffer position 8 is entirely > > in invisible text, and current-indentation only accounts for _visible_ > > whitespace, per the above documentation. > > Thanks for the reference, it explains the problem. > But this is a very strange logic. I don't get it. > Why it depends on the presence of the ellipsis > and fails without it? > > Now I see this bug report is a duplicate of bug#56837. If you've read the discussion of bug#56837, then I explained there why this is how it is. In a nutshell, indentation is regarded as display-related aspect, so asking about indentation of invisible text makes no sense. I added that note to the doc string because Ihor asked for that, not in order to describe some algorithmic logic. > This is a problem because modes use 'current-indentation' > to get an outline level in 'outline-level' function, e.g. > > (setq-local outline-level > (lambda () > "`outline-level' function for Python mode." > (1+ (/ (current-indentation) python-indent-offset)))) > > (setq-local outline-level (lambda () (1+ (/ (current-indentation) > ruby-indent-level)))) > > But this fails when users want to remove an ellipsis. I'm surprised the indentation is used for this purpose when it is known that text will be sometimes hidden. May I suggest to use text properties for this purpose? From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 10 12:57:56 2023 Received: (at 60692) by debbugs.gnu.org; 10 Jan 2023 17:57:56 +0000 Received: from localhost ([127.0.0.1]:41071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFIsl-00073T-Vp for submit@debbugs.gnu.org; Tue, 10 Jan 2023 12:57:56 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:54399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFIsk-00072t-Fm for 60692@debbugs.gnu.org; Tue, 10 Jan 2023 12:57:54 -0500 Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id E642CFF809; Tue, 10 Jan 2023 17:57:47 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis In-Reply-To: <838riao6w3.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Jan 2023 15:29:00 +0200") Organization: LINKOV.NET References: <86k01v1y9c.fsf@mail.linkov.net> <83wn5vo8tx.fsf@gnu.org> <83tu0zo76j.fsf@gnu.org> <86k01ulrwl.fsf@mail.linkov.net> <838riao6w3.fsf@gnu.org> Date: Tue, 10 Jan 2023 19:54:11 +0200 Message-ID: <86eds2qnr0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > If you've read the discussion of bug#56837, then I explained there why > this is how it is. In a nutshell, indentation is regarded as > display-related aspect, so asking about indentation of invisible text > makes no sense. But when an ellipsis is used, current-indentation works correctly in invisible text. >> (setq-local outline-level >> (lambda () >> "`outline-level' function for Python mode." >> (1+ (/ (current-indentation) python-indent-offset)))) >> >> (setq-local outline-level (lambda () (1+ (/ (current-indentation) >> ruby-indent-level)))) >> >> But this fails when users want to remove an ellipsis. > > I'm surprised the indentation is used for this purpose when it is > known that text will be sometimes hidden. May I suggest to use text > properties for this purpose? I don't understand how text properties could be used to get the indentation. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 10 13:13:00 2023 Received: (at 60692) by debbugs.gnu.org; 10 Jan 2023 18:13:00 +0000 Received: from localhost ([127.0.0.1]:41097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFJ7L-0007SC-Te for submit@debbugs.gnu.org; Tue, 10 Jan 2023 13:13:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFJ7J-0007Rz-Ut for 60692@debbugs.gnu.org; Tue, 10 Jan 2023 13:12:58 -0500 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 1pFJ7B-0004E1-UG; Tue, 10 Jan 2023 13:12:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VFnwZKanjw7L0dapNi+wk411mZWn5XZM/rB8F0JN7p8=; b=Zd3yT6zdl5eK 0dXdR+C300nfF1zAyBqxmlRfeyNR2Rb9bvcKxJY0ZUQRlNEgVoy+tn0utp0dTHez3VzUU+S2CDTlq MyytCgruPArEpBJ2AERNhhJWLt8+s1p5h/dWWQ+YcAZEPq8VCaRK3GQ0GerxbZpwNAY2c/grdutIB jVQP8hVeal7kQ/xLjpkluoyN3i+yYpxfZmjx1di1g6BnzyRO6RPU9SLpXqFCk8SywFrKpoJCDS+TD llXKalg9nhyseOjtwD2XOInxbL8Y+xzjTnWanksFgMhq+iuSGzLKZ2fNylfgp4MzHPqOJlwe60Ddk gdoKTuxepC9honcLEOoHKQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFJ79-0002Te-GY; Tue, 10 Jan 2023 13:12:49 -0500 Date: Tue, 10 Jan 2023 20:13:15 +0200 Message-Id: <83sfgimf5w.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <86eds2qnr0.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 10 Jan 2023 19:54:11 +0200) Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis References: <86k01v1y9c.fsf@mail.linkov.net> <83wn5vo8tx.fsf@gnu.org> <83tu0zo76j.fsf@gnu.org> <86k01ulrwl.fsf@mail.linkov.net> <838riao6w3.fsf@gnu.org> <86eds2qnr0.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60692 Cc: 60692@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Juri Linkov > Cc: 60692@debbugs.gnu.org > Date: Tue, 10 Jan 2023 19:54:11 +0200 > > > If you've read the discussion of bug#56837, then I explained there why > > this is how it is. In a nutshell, indentation is regarded as > > display-related aspect, so asking about indentation of invisible text > > makes no sense. > > But when an ellipsis is used, current-indentation > works correctly in invisible text. Because the ellipsis replaces the invisible text, and current-indentation accounts for the ellipsis. When the ellipsis isn't present, there's nothing to account for. In any case, if you want to know the indentation disregarding invisible property, current-indentation is not what you want. > > >> (setq-local outline-level > >> (lambda () > >> "`outline-level' function for Python mode." > >> (1+ (/ (current-indentation) python-indent-offset)))) > >> > >> (setq-local outline-level (lambda () (1+ (/ (current-indentation) > >> ruby-indent-level)))) > >> > >> But this fails when users want to remove an ellipsis. > > > > I'm surprised the indentation is used for this purpose when it is > > known that text will be sometimes hidden. May I suggest to use text > > properties for this purpose? > > I don't understand how text properties could be used to get > the indentation. Before you hide anything, analyze the indentation and assign to each outline level the value of the property that equals the level. Then you can know the level of any piece of text just by accessing the property value.