[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: display-time-string-forms
From: |
Drew Adams |
Subject: |
RE: display-time-string-forms |
Date: |
Wed, 10 Oct 2007 11:56:08 -0700 |
> >> I have
> >> (setq display-time-format "%R %Y-%m-%d")
> >> which gives me
> >> 08:47 2007-10-10
> >> in the mode line.
> >
> > What steps do you take to get the time to appear in your
> > modeline? I've messed with this and _never_ been able to get
> > the time to appear in mine.
>
> From menu:
> Options
> Customize Emacs
> Specific options
> display TAB
>
> Then setting 2 of these options should put
> '(display-time-day-and-date t)
> '(display-time-mode t nil (time))
>
> into your .emacs custom-set-variables section.
> There is also the function
> display-time-string-forms
> with which I haven't messed.
>
> Btw, this is in version 21.3. Newer versions certainly have the same
> functionality.
Icicles can help you _find_ what you might need to customize:
M-x icicle-vardoc RET .* C-q C-g C-j .*time S-SPC .*mode[- ]line
This shows, as completion candidates, all variables, with their doc strings,
for which all of the following are true:
* the variable name matches anything: .*
* the doc string contains "time": .*time
* the doc string also contains either "mode-line" or "mode line":
.*mode[- ]line
The order in the doc string of "time" and "mode-line" (or "mode line") does not
matter - all possible orders are considered when you use `S-SPC'.
The incantation C-q C-g C-j just matches the separator used between variable
name and doc string, for each completion candidate. The default separator is
C-g C-j, and C-q is used to quote the C-q character. (In Icicles, C-j is
self-inserting and does not need to be quoted.)
This quickly shows you the following completion candidates (in *Completions*):
appt-display-mode-line
*Non-nil means display minutes to appointment and time on the mode line.
This is in addition to any other display of appointment messages.
--
display-time-format
*String specifying format for displaying the time in the mode line.
See the function `format-time-string' for an explanation of
how to write this string. If this is nil, the defaults
depend on `display-time-day-and-date' and `display-time-24hr-format'.
--
display-time-hook
*List of functions to be called when the time is updated on the mode line.
--
display-time-interval
*Seconds between updates of time in the mode line.
--
display-time-string-forms
*List of expressions governing display of the time in the mode line.
For most purposes, you can control the time format using `display-time-format'
which is a more standard interface.
This expression is a list of expressions that can involve the keywords
`load', `day', `month', and `year', `12-hours', `24-hours', `minutes',
`seconds', all numbers in string form, and `monthname', `dayname', `am-pm',
and `time-zone' all alphabetic strings, and `mail' a true/nil value.
For example, the form
'((substring year -2) "/" month "/" day
" " 24-hours ":" minutes ":" seconds
(if time-zone " (") time-zone (if time-zone ")")
(if mail " Mail" ""))
would give mode line times like `94/12/30 21:07:48 (UTC)'.
--
You can further reduce the number of candidates by filtering with one or more
additional patterns (e.g. S-SPC format).
Even more generally, you can look at all functions and all variables whose doc
strings contain the strings "time" and either "mode-line" or "mode line":
M-x icicle-doc RET time S-SPC mode[- ]line
That shows, as completion candidates, the doc strings of all functions and all
variables that contain both "time" and either "mode-line" or "mode line", in
either order. Click `mouse-2' on any candidate to see it (including the
function or variable name) displayed in *Help*. Again, you can use additional
patterns to further reduce the number of hits.