help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Minibuffer tray to display current time and date


From: Alexander Shukaev
Subject: Re: Minibuffer tray to display current time and date
Date: Tue, 12 May 2015 13:34:20 +0200

On Wed, May 6, 2015 at 2:49 PM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> >                                          `((space :align-to
> >                                                   (- right
> >                                                      (length ,string)))))
>
> If you look at the documentation for the display property, and more
> specifically for the `space' specifications, you'll see that the HPOS
> element can be of the form:
>
>        EXPR ::= NUM | (NUM) | UNIT | ELEM | POS | IMAGE | FORM
>        NUM  ::= INTEGER | FLOAT | SYMBOL
>        UNIT ::= in | mm | cm | width | height
>        ELEM ::= left-fringe | right-fringe | left-margin | right-margin
>              |  scroll-bar | text
>        POS  ::= left | center | right
>        FORM ::= (NUM . EXPR) | (OP EXPR ...)
>        OP   ::= + | -
>
> So, as you can see, there is no "(length EXP)" form in there.So you need
> to use
>
>    ,(length string)
>
> instead of
>
>    (length ,string)
>
>
> -- Stefan
>

​
Thanks for this remark, Stefan.  I've modified the code and it looks
​now ​
as follows:

  (setq-default minibuffer-line-format
                `((:eval
                   (let ((string (concat
                                  (propertize (format-time-string
"%Y.%m.%d")
                                              'face
                                              'minibuffer-line-date)
                                  " "
                                  (propertize (format-time-string "%A")
                                              'face
                                              'minibuffer-line-weekday)
                                  " "
                                  (propertize (format-time-string "%R")
                                              'face
                                              'minibuffer-line-time))))
                     (concat (propertize " "
                                         'display
                                         `((space :align-to
                                                  (- right
                                                     right-fringe
                                                     ,(length string)))))
                             string)))))

It is aligned correctly now, but the faces are still not propagated, or
rather only the first one is (the default one from `display' alignment).  I
feel like I don't understand something fundamental about `eval:' or maybe
there is a bug here?  I'd be grateful if you could explain this problem.
Thank you.

Regards,
Alexander


reply via email to

[Prev in Thread] Current Thread [Next in Thread]