From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Using :align-to with non-spaces
Date: Tue, 10 Oct 2017 21:27:17 +0300 [thread overview]
Message-ID: <83lgkiq2nu.fsf@gnu.org> (raw)
In-Reply-To: <87mv4ydgcu.fsf@gmail.com> (message from Alex on Tue, 10 Oct 2017 12:09:53 -0600)
> From: Alex <agrambot@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 10 Oct 2017 12:09:53 -0600
>
> > FWIW, having a 'space' display property on some whitespace character
> > sounds very intuitive to me, since this feature was supposed to be
> > used to display white space subject to pixel-level resolution
> > considerations of a GUI frame.
>
> It does to me as well, but it would be nice to have similar
> functionality to :align-to in arbitrary strings.
>
> Something like the following, that would align the string similar to
> :align-to does a space:
>
> (propertize "test"
> 'display
> '(align-to EXPR))
>
> where EXPR can be the same as in :align-to.
:align-to doesn't align the space, it produces a stretch of white
space that _ends_ at the place which :align-to defines. That's why it
makes sense to put this property on a SPC character: it makes that SPC
character's width on display be as you need it.
> I don't understand. The Info mode header isn't aligned at all (for
> example, toggling fringe and linum-mode (for the margin) doesn't change
> the position of the info header). Only headers with an `:align-to num'
> property would be affected.
Ah, you want :align-to take the line numbers into consideration!
It doesn't because neither does that happen with line-prefix or
wrap-prefix. IOW, :align-to measures from the edges of the window's
text area.
> Here is what the manual says about :align-to:
>
> For example, ‘:align-to 0’ in a header-line aligns with the first
> text column in the text area.
>
> I would consider "the first text column" to be column 0, so the current
> behaviour is incorrect.
The "text area" is everything inside the fringes/display margins
(whichever comes last), so it includes the space used for the
line-number display.
> If line-number display is treated specially
It isn't: it is treated the same as line-prefix and wrap-prefix.
> then there should also be a `line-number' element for the :align-to
> and :width specs.
The solution I can suggest is to use the value returned by
line-number-display-width.
next prev parent reply other threads:[~2017-10-10 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 5:22 Using :align-to with non-spaces Alex
2017-10-10 6:40 ` Eli Zaretskii
2017-10-10 18:09 ` Alex
2017-10-10 18:27 ` Eli Zaretskii [this message]
2017-10-10 19:18 ` Alex
2017-10-10 20:01 ` Eli Zaretskii
2017-10-11 0:41 ` Alex
2017-10-11 10:38 ` Eli Zaretskii
2017-10-12 0:47 ` Stefan Monnier
2017-10-12 7:10 ` 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=83lgkiq2nu.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.