all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: right aligning a string, using display (space :align-to
Date: Fri, 20 Oct 2023 21:06:32 +0300	[thread overview]
Message-ID: <83mswdrwwn.fsf@gnu.org> (raw)
In-Reply-To: <91dfec1f-b760-4de4-a332-b2af4199595a@riseup.net> (martianhiatus@riseup.net)

> Date: Fri, 20 Oct 2023 18:06:31 +0200
> From: martianhiatus@riseup.net
> 
> 
> > (concat
> >  (propertize " "
> >              'display
> >              `(space :align-to (- right
> >                                   ,(list (string-pixel-width stats)))))
> >  str)
> > 
> > and then it will work.
> 
> hi eli, thanks. i had tried to (list) the whole expression following :align-to.
> 
> it does work, but it still doesn't work with text-scaling. if i increase text-scale, my right-aligned string is broken over to the next line, same as when not using pixel-width alignment. if i decrease text scaling, my right-aligned string is further from the right margin.
> 
> i thought the two might be linked, but the behavior is the same.
> 
> do you have any ideas about how to not break :align-to while text scaling?

You assume that string-pixel-width takes text-scaling into account?  I
don't think it does; you should use window-text-pixel-size or
buffer-text-pixel-size instead.  That's because text-scaling is a
buffer-local feature, and string-pixel-width is not told which buffer
you have in mind.



  reply	other threads:[~2023-10-20 18:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 16:06 right aligning a string, using display (space :align-to martianhiatus
2023-10-20 18:06 ` Eli Zaretskii [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-10-20 20:05 martianhiatus
2023-10-21  6:35 ` Eli Zaretskii
2023-10-19 18:05 martianhiatus
2023-10-20  6:41 ` 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

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

  git send-email \
    --in-reply-to=83mswdrwwn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.