all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 69611@debbugs.gnu.org
Subject: bug#69611: 30.0.50; Long bidi line with control characters freezes Emacs
Date: Thu, 07 Mar 2024 21:19:31 +0200	[thread overview]
Message-ID: <86r0gl26kc.fsf@gnu.org> (raw)
In-Reply-To: <87h6hi6iaz.fsf@gmx.net> (message from Stephen Berman on Thu, 07 Mar 2024 18:52:20 +0100)

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: 69611@debbugs.gnu.org
> Date: Thu, 07 Mar 2024 18:52:20 +0100
> 
> In the case of the file I sent you, I may be to blame for the unbalanced
> control characters: after yanking the Arabic into Emacs, I did some
> editing of it and may well have unintentionally deleted some of the
> control characters.  At the time I wasn't even aware of these; only
> after (re)reading the section on bidirectional display in the Elisp
> manual did I enable glyphless-display-mode and saw the characters, but I
> didn't bother to check if they paired up properly.

In that case, it could be that the original file wouldn't be so
expensive, if each short Arabic string was included in a right-to-left
embedding, i.e. RLE before it and PDF after it.  Then we wouldn't have
nested embeddings, and each embedding would be quite short.  This
should produce quite "normal" display speed, not different from when
displaying bidirectional text without the control characters at all.
IOW, it could be that by deleting some of the controls you created the
nested embeddings that were not there in the first place.

> > The extremely deep nesting of embeddings in the file, coupled with the
> > fact that the first embedding starts near the beginning of the file,
> > but ends very near its end, causes the algorithm that finds where to
> > position the cursor to fail, because it cannot cope with the situation
> > where, after C-f or C-b, the position of point is very far outside of
> > the window.  I guess this causes some infloop (even though I don't see
> > it here, I just see that the cursor doesn't move although point does
> > move).  It could also be just a very long calculation, not an infloop,
> > because finding where to place the window-start point in this case is
> > also very expensive.
> 
> Ok.  But this is only an issue in conjunction with long lines, right?

Yes, because all the embedding levels are reset at the newline.  So
having a newline not far away guarantees that the reordering code
doesn't need to look too far for where the embedding ends.

> > This file is an interesting curiosity, as far as I'm concerned, but I
> > doubt whether I will find enough time and motivation to try to speed
> > up Emacs when such crazy files are visited.
> 
> Given the special circumstances of this file's creation I think there's
> no need to spend any more time it, so unless you decide you do want to,
> as far as I'm concerned this bug can be closed.  It might be beneficial
> to others to document the issue briefly, either in the Elisp manual
> under Bidirectional Display or just in etc/PROBLEMS, but maybe this is
> such an unusual case that even that isn't worth the effort.

I doubt it's worth describing, since even explaining what happens
needs a long treatise on what are bidirectional embedding levels, how
they affect reordering, and how Emacs implements that reordering in a
way that fits into the general structure of the Emacs display code
(which examines characters in their visual order).  We'd basically
need to copy into PROBLEMS or the manual large portions of the
commentary at the beginning of bidi.c, which includes a lot of
technical details.





  reply	other threads:[~2024-03-07 19:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 13:42 bug#69611: 30.0.50; Long bidi line with control characters freezes Emacs Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 15:42 ` Eli Zaretskii
2024-03-07 17:52   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 19:19     ` Eli Zaretskii [this message]
2024-03-07 21:21       ` Stephen Berman 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

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

  git send-email \
    --in-reply-to=86r0gl26kc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=69611@debbugs.gnu.org \
    --cc=stephen.berman@gmx.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.