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: Emanuel Berg
Subject: Re: Minibuffer tray to display current time and date
Date: Tue, 12 May 2015 19:24:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Alexander Shukaev <haroogan@gmail.com> writes:

>   (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.

Try 'font-lock-face instead of 'face:

    (insert
       (propertize "Type'd up" 'font-lock-face 'font-lock-type-face))

As for :eval that doesn't do anything. It is just
a marker that says this should be evaluated (each
time) but this has to be implemented in each case (or
"somewhere else" if this is a convention - its in
`mode-line-format' as well).

The reason you can't do it with a backtick and commas
is if so that would evaluate only once (when you
`setq' the variable) but as time (sadly) flies, you
want it to be set each time and this has to be
implemented, and :eval is one way to do so.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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