GNU bug report logs - #52129
29.0.50; Wish: Extend `:align-to center' to work on lines in buffer

Previous Next

Package: emacs;

Reported by: Arthur Miller <arthur.miller <at> live.com>

Date: Fri, 26 Nov 2021 20:22:01 UTC

Severity: normal

Tags: wontfix

Found in version 29.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arthur Miller <arthur.miller <at> live.com>
Cc: 52129 <at> 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
> From: Arthur Miller <arthur.miller <at> live.com>
> Cc: 52129 <at> 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.




This bug report was last modified 3 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.