From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, 64696@debbugs.gnu.org
Subject: bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible
Date: Sun, 30 Jul 2023 07:51:09 +0000 [thread overview]
Message-ID: <87tttlj0r6.fsf@localhost> (raw)
In-Reply-To: <83cz0bm2hn.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
>> I do not think that double scan will be needed. Just space width
>> calculation is to be postponed until the line is processed.
>
> That's what I meant by "double scan". The Emacs display engine never
> looks back, once it processed some text property. Looking back is
> particularly unacceptable when the display engine is called to start
> in the middle of the line, because it would mean we need always go to
> the beginning of the line.
What about fill_up_glyph_row_area_with_spaces and
fill_up_frame_row_with_spaces? They append extra space glyphs to build
up to window/frame width. And what I propose would enlarge some
existing space glyphs instead.
>> > Why does Org need to take up all the available space of a window to
>> > begin with, btw?
>>
>> To produce right-aligned text columns:
>>
>> * Heading :tag1:tag2:tag3:
>> * Another heading :tag4:
>
> I guessed that much, but my point is: why not set some reasonable
> fixed right position, and align to that?
That's what we do (org-tags-column). However, people often ask for
auto-adjustment to right margin when frame/window is resized.
The usual use-case for auto-adjustment is when Org/agenda window is
first built as a sole window in the frame and then user splits the frame
into two windows vertically:
* Heading :tag1:tag2:tag3:
* Another heading :tag4:
* Heading →| Other text file here.
* Another heading →| Tags on the left are not visible.
or
* Heading ⤶| Other text file here.
:tag1:tag2:tag3: | Tags wrapped and look ugly.
* Another heading ⤶|
:tag4: |
> If that is the problem, you should use buffer-text-pixel-size or
> window-text-pixel-size instead.
Good point. Thanks!
>> My original concern was about `string-width' not producing reliable
>> results when Emacs visual settings are changed. And, indeed, some
>> visuals that are not detailed in the docstring are taken into account.
>>
>> The purpose of using `string-width' in `org-current-text-column' is to
>> produce reliable result for different users with different visual
>> settings and fonts. This is because indentation is used in Org syntax
>> and must not be broken if the Org file is unchanged and visual settings
>> are.
>
> How does your proposal for the change in the doc string serve these
> issues? I asked a specific question about your proposed change, and I
> don't think what you say above answers that specific question?
I was referring to one step earlier in the discussion:
>> A toggle: disable all visual contributors.
> It will never be used.
I would use it in Org instead of `org-current-text-column'.
It currently relies upon `string-width' ignoring visuals, which may or
may not hold in future (the docstring implies that `string-width' may as
well consider visuals: "Return width of STRING when displayed in the
current buffer.")
You pointed that my docstring reference did not include the whole
docstring and that the docstring, in fact, does say that visuals have
"limited" effect. So, I proceeded with docstring suggestion to highlight
that window settings have no effect.
My suggestion turned out to be wrong: (1) variable pitch faces can
affect the results for glyphs; (2) buffer-display-table can alter the
results.
And note that the full docstring of `string-width' does not mention the
above 2 factors. It just mentions a small subset of visual settings that
_do not_ affect the results. Which is deceiving.
> If variable-pitch fonts are used for the _default_ face's font, then
> using string-width as the measure of width on display is clearly
> inadequate to begin with, isn't it?
So, we coming back to the original discussion about a toggle to disable
"visuals", there seems to be a need in it, at the end.
`org-current-text-column' is clearly not 100% reliable when using
`string-width'.
> I don't understand why "ignore". But TBH, I don't think I understand
> what are you trying to accomplish with this long discussion.
We have discussed multiple topics in this thread. From my point point of
view, things are mostly revolving around understanding how
invisible/display/other visual settings are affecting `indent-to', and
`current-column'. Because on Org mode side, we sometimes want and
sometimes don't want to account for visuals.
On Emacs side, I can see that full, partial, or limited subset of visual
settings is accounted for in various functions, like `indent-to',
`current-column', and `string-width'. Not everything is clearly
documented for `string-width' and accounting for invisible text
properties is not fully consistent in `indent-to'.
>> Org syntax must not depend on Emacs visual settings.
>
> If that is what you are trying to do, I think you will have quite a
> few difficulties. Emacs does not cater to such applications,
> especially when you are using APIs whose purpose was to support
> display and layout calculations.
I'd prefer to use the existing API if possible. But to do it, I first
want to understand its logic. Inconsistencies in this logic is what this
report is about.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-07-30 7:51 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 7:58 bug#64696: 30.0.50; indent-to inherits preceding text properties, including 'invisible Ihor Radchenko
2023-07-18 11:23 ` Eli Zaretskii
2023-07-18 12:09 ` Ihor Radchenko
2023-07-18 13:10 ` Eli Zaretskii
2023-07-18 13:25 ` Ihor Radchenko
2023-07-18 16:13 ` Eli Zaretskii
2023-07-18 16:25 ` Ihor Radchenko
2023-07-18 17:08 ` Eli Zaretskii
2023-07-19 8:30 ` Ihor Radchenko
2023-07-19 13:07 ` Eli Zaretskii
2023-07-20 9:10 ` Ihor Radchenko
2023-07-21 8:32 ` Ihor Radchenko
2023-07-22 6:51 ` Eli Zaretskii
2023-07-22 7:09 ` Ihor Radchenko
2023-07-22 11:35 ` Eli Zaretskii
2023-07-22 14:10 ` Ihor Radchenko
2023-07-22 14:31 ` Eli Zaretskii
2023-07-22 6:49 ` Eli Zaretskii
2023-07-22 7:03 ` Ihor Radchenko
2023-07-22 11:22 ` Eli Zaretskii
2023-07-22 14:05 ` Ihor Radchenko
2023-07-22 14:28 ` Eli Zaretskii
2023-07-23 7:30 ` Ihor Radchenko
2023-07-23 10:05 ` Eli Zaretskii
2023-07-24 8:18 ` Ihor Radchenko
2023-07-24 13:09 ` Eli Zaretskii
2023-07-25 8:38 ` Ihor Radchenko
2023-07-25 12:37 ` Eli Zaretskii
2023-07-27 8:58 ` Ihor Radchenko
2023-07-27 9:15 ` Eli Zaretskii
2023-07-28 8:06 ` Ihor Radchenko
2023-07-28 11:52 ` Eli Zaretskii
2023-07-29 9:00 ` Ihor Radchenko
2023-07-29 10:33 ` Eli Zaretskii
2023-07-30 7:51 ` Ihor Radchenko [this message]
2023-07-30 9:59 ` Eli Zaretskii
2023-07-30 11:45 ` Ihor Radchenko
2023-07-30 17:11 ` Eli Zaretskii
2023-07-31 7:18 ` Ihor Radchenko
2023-07-31 11:49 ` Eli Zaretskii
2023-07-28 2:53 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-28 8:30 ` Ihor Radchenko
2023-07-28 12:06 ` Eli Zaretskii
2023-07-28 12:26 ` Ihor Radchenko
2023-07-28 12:48 ` Eli Zaretskii
2023-07-28 13:02 ` Ihor Radchenko
2023-07-28 14:17 ` Eli Zaretskii
2023-07-29 9:06 ` Ihor Radchenko
2023-07-22 13:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 14:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 16:20 ` Eli Zaretskii
2023-07-18 19:33 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-19 8:42 ` Ihor Radchenko
2023-07-19 13:10 ` Eli Zaretskii
2023-07-19 14:25 ` Ihor Radchenko
2023-07-19 15:09 ` Eli Zaretskii
2023-07-19 8:41 ` Ihor Radchenko
2023-07-19 13:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=87tttlj0r6.fsf@localhost \
--to=yantar92@posteo.net \
--cc=64696@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).