unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 56837@debbugs.gnu.org
Subject: bug#56837: 28.1.90; `current-indentation' sometimes returns zero inside invisible text
Date: Sat, 30 Jul 2022 17:08:12 +0800	[thread overview]
Message-ID: <87v8rfq877.fsf@localhost> (raw)
In-Reply-To: <83r12356fy.fsf@gnu.org>

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	other threads:[~2022-07-30  9:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-30  7:56 bug#56837: 28.1.90; `current-indentation' sometimes returns zero inside invisible text Ihor Radchenko
2022-07-30  8:51 ` Eli Zaretskii
2022-07-30  9:08   ` Ihor Radchenko [this message]
2022-07-30 10:08     ` Eli Zaretskii
2022-07-30 11:27       ` Ihor Radchenko
2022-07-30 11:38         ` Eli Zaretskii
2022-07-30 11:49           ` Ihor Radchenko
2022-07-30 13:25             ` Eli Zaretskii
2022-07-30 16:35           ` Eli Zaretskii
2022-07-31  8:12           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8rfq877.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=56837@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).