GNU bug report logs - #60692
29.0.60; current-indentation wrong without outline ellipsis

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Juri Linkov <juri@HIDDEN>; merged with #56837, #56838; dated Mon, 9 Jan 2023 17:36:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Forcibly Merged 56837 56838 60692. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60692 <at> debbugs.gnu.org:


Received: (at 60692) by debbugs.gnu.org; 10 Jan 2023 08:25:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 10 03:25:46 2023
Received: from localhost ([127.0.0.1]:38707 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pF9x4-0004dq-KX
	for submit <at> 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 <juri@HIDDEN>)
 id 1pF9x3-0004dO-0U; Tue, 10 Jan 2023 03:25:45 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id AFC96C0007;
 Tue, 10 Jan 2023 08:25:36 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#60692: 29.0.60; current-indentation wrong without outline
 ellipsis
In-Reply-To: <83tu0zo76j.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 09 Jan
 2023 21:10:28 +0200")
Organization: LINKOV.NET
References: <86k01v1y9c.fsf@HIDDEN> <83wn5vo8tx.fsf@HIDDEN>
 <83tu0zo76j.fsf@HIDDEN>
Date: Tue, 10 Jan 2023 10:20:20 +0200
Message-ID: <86k01ulrwl.fsf@HIDDEN>
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 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60692; Package emacs. Full text available.

Message received at 60692 <at> debbugs.gnu.org:


Received: (at 60692) by debbugs.gnu.org; 9 Jan 2023 19:10:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 09 14:10:10 2023
Received: from localhost ([127.0.0.1]:38192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pExX8-0006lC-Et
	for submit <at> 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 <eliz@HIDDEN>) id 1pExX6-0006ky-LZ
 for 60692 <at> 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 <eliz@HIDDEN>)
 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 <eliz@HIDDEN>)
 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@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: juri@HIDDEN
In-Reply-To: <83wn5vo8tx.fsf@HIDDEN> (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@HIDDEN> <83wn5vo8tx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60692
Cc: 60692 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 60692 <at> debbugs.gnu.org
> Date: Mon, 09 Jan 2023 20:34:50 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Juri Linkov <juri@HIDDEN>
> > 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60692; Package emacs. Full text available.

Message received at 60692 <at> debbugs.gnu.org:


Received: (at 60692) by debbugs.gnu.org; 9 Jan 2023 18:34:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 09 13:34:42 2023
Received: from localhost ([127.0.0.1]:38159 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pEwyo-0005kT-GU
	for submit <at> 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 <eliz@HIDDEN>) id 1pEwym-0005kF-R6
 for 60692 <at> 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 <eliz@HIDDEN>)
 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 <eliz@HIDDEN>)
 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@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86k01v1y9c.fsf@HIDDEN> (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@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60692
Cc: 60692 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60692; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jan 2023 17:35:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 09 12:35:40 2023
Received: from localhost ([127.0.0.1]:38097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pEw3g-0004Dv-1m
	for submit <at> 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 <juri@HIDDEN>) id 1pEw3e-0004Dn-0Z
 for submit <at> 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 <juri@HIDDEN>) id 1pEw3R-0007M8-2k
 for bug-gnu-emacs@HIDDEN; 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 <juri@HIDDEN>) id 1pEw3N-0005JQ-Ur
 for bug-gnu-emacs@HIDDEN; Mon, 09 Jan 2023 12:35:24 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 9BA71C0009
 for <bug-gnu-emacs@HIDDEN>; Mon,  9 Jan 2023 17:35:19 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: bug-gnu-emacs@HIDDEN
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@HIDDEN>
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@HIDDEN;
 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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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.




Acknowledgement sent to Juri Linkov <juri@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#60692; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 10 Jan 2023 08:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.