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, 23 Jul 2023 13:05:30 +0300	[thread overview]
Message-ID: <83wmyrt02d.fsf@gnu.org> (raw)
In-Reply-To: <87bkg3rso5.fsf@localhost> (message from Ihor Radchenko on Sun, 23 Jul 2023 07:30:34 +0000)

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: monnier@iro.umontreal.ca, 64696@debbugs.gnu.org
> Date: Sun, 23 Jul 2023 07:30:34 +0000
> 
> On one hand, Emacs' indentation is nicely aligning text as is it
> actually displayed in the buffer, taking into account all kinds of bells
> and whistles that alter the displayed text width.
> 
> On the other hand, such visual indentation is not always good. Visuals
> present in one Emacs config may not be enabled in another config. And
> code/text nicely aligned on one machine will suddenly look ugly on
> other. For example, see
> http://endlessparentheses.com/using-prettify-symbols-in-clojure-and-elisp-without-breaking-indentation.html

Programs that want "indentation" that only counts codepoints (which is
really a rare situation, see below) need to disable all kinds of Emacs
features, otherwise they will not get what they want.

> In Org mode, visual indentation is also not necessarily good thing:
> 
> 1. Org mode is generally aiming for the produced Org files to be
>    readable as unfontified plain text. So, quirks related to visual
>    indentation generally tend to mess things up.

"Unfontified"?  AFAIK, Org files do use fontifications, don't they?
So what do you mean by "unfontified plain text" here?  But that's an
aside, feel free to ignore.

> 2. Org mode uses indentation as part of the syntax. I had to get rid of
>    using `current-column' and calculated "true textual indentation"
>    manually to avoid breakage after `current-column' started to take
>    into account invisibility. (bug#56837)

This cannot be avoided.  Emacs provides by default many features that
"mess up" this kind of "true textual indentation".  Some of these
features include:

  . character composition
  . tab expansion
  . display properties that hide text and display some other text
  . display properties that align text
  . faces that affect character metrics via fonts
  . invisible text

(I'm probably missing some more.)  Only the Lisp program knows which
of those are relevant to the particular application at hand.  For
example, in your "true textual indentation", how do you account for
U+0061 LATIN SMALL LETTER A followed by U+0301 COMBINING ACUTE ACCENT?
They are almost always displayed as a single glyph: á.  Do you
consider this a single column or 2 columns?  What about long Emoji
sequences?

We could introduce separate indentation/current-column knobs for each
of the above features, but it would make little sense to me, since
most, if not all, of them already have such knobs.  For example,
character composition can be disabled by flipping a variable.

> > I don't insist in making that change.  Quite the opposite, actually.
> > I also expect it to break gobs of indentation code where invisible
> > text is involved.  Indentation code should probably temporarily remove
> > the invisibility spec, while indenting, or something.
> 
> That would make sense, yes.
> 
> > The main motivation to fix scan_for_column to consider more visual
> > effects was so vertical cursor motion works as expected when large
> > portions of text are hidden.
> 
> What about having something like `current-visual-column' that will be
> used when we really need to examine which display column the cursor is
> it, accounting for all the display-affecting properties?
> 
> Or maybe even have `use-visual-columns' variable that will modify how
> `current-column' behaves ('visual, 'textual, 'visual-ignore-invisible,
> etc)

See above: you are actually opening a Pandora box, and any solution
will likely be based on existing variables.  So I think we already
have what you want, it just might not be immediately obvious in each
case which of the knobs to use.  The default behavior of
current-column can already be affected by disabling
auto-composition-mode, by tweaking the buffer's invisibility spec, and
by defining display properties whose values are conditional.  Tab
expansion can also be controlled.  What else would make sense?





  reply	other threads:[~2023-07-23 10:05 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 [this message]
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
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=83wmyrt02d.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).