unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 69384@debbugs.gnu.org
Subject: bug#69384: 30.0.50; :align-to and bidi-paragraph-direction interaction
Date: Sun, 25 Feb 2024 21:45:43 +0200	[thread overview]
Message-ID: <86cyskwcns.fsf@gnu.org> (raw)
In-Reply-To: <87v86cz9g0.fsf@gmx.net> (message from Stephen Berman on Sun, 25 Feb 2024 19:26:55 +0100)

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: 69384@debbugs.gnu.org
> Date: Sun, 25 Feb 2024 19:26:55 +0100
> 
> On Sun, 25 Feb 2024 19:35:22 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > I don't understand well enough what were you trying to achieve, so I
> > cannot suggest how to do that.
> 
> I want to display RTL text aligned with LTR text; the buffer contains
> mainly LTR text.  Currently just setting bidi-paragraph-direction to
> 'left-to-right is sufficient for aligning at column 0, but I may want to
> align to some column in the middle of the window, which I why I tried
> using :align-to and found calculating the needed value cumbersome.

Sorry, this is still too vague.  What do you mean by "RTL text aligned
with LTR text"? "aligned" in what way and sense?

How about an example of text showing what you want to do?  To avoid
strange effects of bidi reordering, please use lower-case letters to
represent LTR text and upper-case letters to represent RTL text.

> > What do you mean by "first column (0) in LTR order"?  D|o you mean the
> > leftmost column in the visual order? something else?
> 
> Yes, column 0 as in a buffer containing only LTR text.

Please don't talk about column numbers in this context, because it's
confusing: in RTL text columns are counted from the right.  "Leftmost
column", by contrast, is clear.

> >> the first two examples were meant to show that using these
> >> individually also works.  But I gather from your reply that I've
> >> misunderstood what :align-to set to 0 means; can you enlighten me?
> >
> > It's supposed to be a no-op, of course.  Exactly like in the strict
> > LTR unidirectional text.  What else can it mean?
> 
> I now realize I shouldn't have used :align-to 0 for this case, since
> setting bidi-paragraph-direction to 'left-to-right already gives the
> desired column-0 alignment.

Exactly.

> It's for alignment to a columns > 0 that :align-to in combination
> with bidi-paragraph-direction could be useful, if the value of
> :align-to were easy to use, e.g. simply to to align the RTL text to
> LTR-column 20 (instead of having to do some trial-and-error
> calculation).  But the broken shaping thwarts that.

You should be able to do that without tweaking
bidi-paragraph-direction, since :align-to can use the 'left' and
'right' positions.  For example:

  (let* ((a "السّلام عليكم")
	 (b "Hello")
	 (buf (get-buffer-create "Test3")))
    (with-current-buffer buf
      (erase-buffer)
      (insert (propertize " " 'display
                              `(space :align-to (- right 20))) a "\n\n" b)
      (switch-to-buffer buf)))

(Except that it looks like 'left' and 'right' are reversed in this
case, probably a bug.)

You can also use 'text' to stand for the width of the text-area of a
window.





  reply	other threads:[~2024-02-25 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25 16:22 bug#69384: 30.0.50; :align-to and bidi-paragraph-direction interaction Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-25 16:47 ` Eli Zaretskii
2024-02-25 17:17   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-25 17:35     ` Eli Zaretskii
2024-02-25 18:26       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-25 19:45         ` Eli Zaretskii [this message]
2024-02-25 21:18           ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-26 12:41             ` Eli Zaretskii
2024-02-26 14:12               ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-26 17:28       ` Eli Zaretskii
2024-02-26 21:46         ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-27  7:44           ` Eli Zaretskii

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=86cyskwcns.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=69384@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 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).