bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56837: 28.1.90; `current-indentation' sometimes returns zero inside


From: Ihor Radchenko
Subject: bug#56837: 28.1.90; `current-indentation' sometimes returns zero inside invisible text
Date: Sat, 30 Jul 2022 17:08:12 +0800

Eli Zaretskii <eliz@gnu.org> writes:

> I don't understand what is the purpose of asking about indentation of
> a line that is completely invisible.  current-indentation skips
> invisible characters, so if everything is invisible, why do you expect
> any useful result?

This is needed for parsing. In Org, indentation defines the list level.
Similarly, indentation is meaningful in Python.

Since parsed text can be hidden inside fold (using org-mode,
or outline-mode; the latter may also be used in Python buffers), getting
an accurate indentation is important even when text is invisible.

> Technically, the difference between the two results is because
> current-indentation tries to account for the ellipsis (which is
> present in the first case but not in the second).  But that's not
> relevant to the larger issue at hand here.

I do not understand how ellipsis can be meaningfully accounted for with
regard to indentation. AFAIU, they are not. Try

* something
          a
* else

4. Move point to "* <point>something"
5. <TAB> to fold the outline
6. M-: (save-excursion (search-forward " a") (current-indentation))
   ;; => 10

> Bottom line: I think you are hitting undefined behavior here.

Maybe. But then I'd like to be able to get the "hard" indentation
information for the underlying text in buffer, accounting for tab-width,
and disregarding overlays and other font-lock staff.

As I mentioned above, this is required for parsing.

Best,
Ihor





reply via email to

[Prev in Thread] Current Thread [Next in Thread]