unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
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 09:40:50 +0300	[thread overview]
Message-ID: <83fuarqzd9.fsf@gnu.org> (raw)
In-Reply-To: <87zi90yjws.fsf@gmail.com> (message from Alex on Sun, 08 Oct 2017 23:22:59 -0600)

> From: Alex <agrambot@gmail.com>
> Cc: eliz@gnu.org
> Date: Sun, 08 Oct 2017 23:22:59 -0600
> 
> (setq header-line-format
>       (concat (propertize " "
>                           'display
>                           '(space . (:align-to 0)))
>               "test"))
> 
> (setq header-line-format
>       (propertize "test"
>                   'display
>                   '(space . (:align-to 0))))
> 
> It's not a big deal, but it's makes things look cleaner, especially when
> the string in question is also being propertized.

The 'space' display property is of the "replacing" kind, i.e. it
completely replaces the text which has that property.  So implementing
what you want would need a new property at least.  Or maybe you could
use the '(space-width FACTOR)' display spec instead, and prepending a
single SPC character that precedes the string characters?  (This
assumes the string itself doesn't have embedded SPC characters; if it
does, put this display property only on the initial SPC character.)

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.

> P.S. I noticed that the above does not take into account the space taken
> by `display-line-numbers'.

That's because it isn't clear whether it should be done for every
header-line.  For example, the Info mode will certainly not want
that.  So this has to be done by the Lisp program, because only it
knows whether the text in the header line should be aligned with the
rest of buffer text.



  reply	other threads:[~2017-10-10  6:40 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 [this message]
2017-10-10 18:09   ` Alex
2017-10-10 18:27     ` Eli Zaretskii
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

  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=83fuarqzd9.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.
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).