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

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Mon, 9 Jan 2023 17:36:02 UTC

Severity: normal

Merged with 56837, 56838

Found in versions 28.1.90, 29.0.60

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60692 <at> debbugs.gnu.org
Subject: bug#60692: 29.0.60; current-indentation wrong without outline ellipsis
Date: Tue, 10 Jan 2023 20:13:15 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: 60692 <at> 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.




This bug report was last modified 2 years and 159 days ago.

Previous Next


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