unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Arthur Miller <arthur.miller@live.com>
Cc: 52129@debbugs.gnu.org
Subject: bug#52129: 29.0.50; Wish: Extend `:align-to center' to work on lines in buffer
Date: Sat, 27 Nov 2021 13:25:13 +0200	[thread overview]
Message-ID: <83r1b1zvqe.fsf@gnu.org> (raw)
In-Reply-To: <AM9PR09MB49774A2F9688B86A4F2BF25096649@AM9PR09MB4977.eurprd09.prod.outlook.com> (message from Arthur Miller on Sat, 27 Nov 2021 12:06:19 +0100)

> From: Arthur Miller <arthur.miller@live.com>
> Cc: 52129@debbugs.gnu.org
> Date: Sat, 27 Nov 2021 12:06:19 +0100
> 
> > No, I mean to put this property:
> >
> >     'display '(space :align-to center)
> >
> > on a space character (or any other character, which will not be
> > displayed) that is prepended to the time-stamp-string you want to
> > display.
> 
> Aha, like this?:
> 
> (defun evc--time ()
>   (concat (propertize " " 'display '(space :align-to center))
>           (propertize
>            (time-stamp-string " %H:%M") 'face evc--time-face)))
> 
> That still seems to be dependanble on when the time string is inserted? Because
> when I test to insert like this:
> 
> (defun evc--update ()
>   (let ((time (evc--time))
>         (date (evc--date)))
>     (when (frame-live-p evc--frame)
>       (select-frame evc--frame))
>     (with-current-buffer evc--buffer
>       (erase-buffer)
>       (insert time "\n" date)
>       (goto-char 1))))
> 
> the string is not centered correctly; there is ~70 pixels difference between
> left and right margins.

That's because it centers the first character of the string, not its
middle character.

> Is there any way to make it aware of surrounding context, like entire line? Or
> would that be too demanding computationally?

I don't think I understand what you mean by "surrounding context", and
what would it mean for it to "be aware" of it?

> I guess there is a reason why it is made one char at a time.

Simplicity and speed, I guess.  But that's not for me to answer: I
wasn't there when this was designed.





  reply	other threads:[~2021-11-27 11:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 20:01 bug#52129: 29.0.50; Wish: Extend `:align-to center' to work on lines in buffer Arthur Miller
2021-11-27  5:59 ` Eli Zaretskii
2021-11-27  8:47   ` Arthur Miller
2021-11-27  9:15     ` Eli Zaretskii
2021-11-27 11:06       ` Arthur Miller
2021-11-27 11:25         ` Eli Zaretskii [this message]
2021-11-27 23:40           ` Arthur Miller
2021-11-28  7:48             ` Eli Zaretskii
2021-11-28 10:38               ` Arthur Miller
2021-11-29 15:59                 ` Lars Ingebrigtsen

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=83r1b1zvqe.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=52129@debbugs.gnu.org \
    --cc=arthur.miller@live.com \
    /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).