unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
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 20:11:51 +0300	[thread overview]
Message-ID: <83mszd2ujs.fsf@gnu.org> (raw)
In-Reply-To: <873515hbcf.fsf@localhost> (message from Ihor Radchenko on Sun, 30 Jul 2023 11:45:20 +0000)

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: monnier@iro.umontreal.ca, 64696@debbugs.gnu.org
> Date: Sun, 30 Jul 2023 11:45:20 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > There's a limit to which a doc string can describe every single
> > subtlety of a non-trivial implementation, and still remain useful.  If
> > someone needs to know about these aspects (presumably because their
> > Lisp program does something very special, because otherwise these
> > things "just work"), they should either read the source or ask here,
> > because they basically use string-width outside of its main usage
> > domain.
> 
> I personally feel confused when looking at the available width
> calculation in Emacs: `string-width', `string-pixel-width',
> `window-text-pixel-size', `length' are all different, and sometimes in
> subtle (and undocumented) ways. For me, the best way to resolve the
> confusion would be more detailed docstrings that explain the
> limitations. I have no better ideas.

string-pixel-width and window-text-pixel-size are different varieties
of the same basic primitive.  Other than that, each of the functions
you mentioned serve a different purpose; in particular, 'length' is
entirely unrelated to the display width of a string.  When each API is
used for its purpose, there's no confusion and no subtleties, because
each one of them does its job, and the subtleties should not matter.
It's only when you want them to do some job they were not directly
designed for that the subtleties become important.  But your
insistence on documenting all of those technicalities is not TRT: it
will just make the documentation much harder to understand and use for
those who do use these APIs for their advertised purposes.

> 1. "When calculating width of a multibyte character in STRING, only the
>    base leading-code is considered; the validity of the following bytes
>    is not checked."

Remnant from a very distant past; ignore it.

> 2. "Tabs in STRING are always taken to occupy tab-width columns."
> 
>    "always" in the above is not accurate when buffer-display-table
>    replaces <TAB> display. Is it considered subtlety?

No, "always" disregarding the column where the TAB will be displayed.
A TAB that begins on column zero will be 8 columns wide; a TAB that
begins on column 5 will be only 3 columns wide.

> 3. "The effect of faces and fonts used for non-Latin and other unusual
>    characters (such as emoji) is ignored as well"
> 
>    Is the effect of faces not ignored for Latin characters?

The default face's font covers those, and if it's a fixed-pitch font,
the character width stored in char-width-table is adequate.

> 4. "... , as are display properties and invisible text"
> 
>    What about other properties? Like 'line-prefix. Maybe "all the text
>    properties are ignored"?

line-prefix doesn't affect the width of the string itself.

"All the text properties" is incorrect: at least 'composition' and
'invisible' aren't ignored.

> 5. "For these reasons, the results are not generally reliable;"
> 
>    This sounds like "this function is not useful".

I've now reworded that part.





  reply	other threads:[~2023-07-30 17:11 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
2023-07-30  9:59                                                         ` Eli Zaretskii
2023-07-30 11:45                                                           ` Ihor Radchenko
2023-07-30 17:11                                                             ` Eli Zaretskii [this message]
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=83mszd2ujs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64696@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /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).