display-time-mode shows the time only in minutes. How I can display time in seconds? Something like
The top of the EmacsWiki page on Display Time tells you how to control the format of the time.
Of the three variables, it looks like
display-time-format is the most relevant after inspecting the docstrings of the variables with
C-h v display-time-format:
String specifying format for displaying the time in the mode line. See the function
format-time-stringfor an explanation of how to write this string. If this is
nil, the defaults depend on
You can customize this variable.
Now, as @lawlist suggested, you can figure out how to set up the string by looking at the docstring for the function
format-time-string, although there are too many options to list here. However, you're probably interested in
%H is the hour on a 24-hour clock, %I is on a 12-hour clock, %k is like %H only blank-padded, %l is like %I blank-padded.
%p is the locale's equivalent of either AM or PM.
%M is the minute.
%S is the second.
So you can either use the customize interface to set
display-time-format, or you can do so directly with:
(setq display-time-format "%I:%M:%S")
However, I doubt you're going to be happy with this functionality. From the Emacs manual on mode line basics:
For efficiency, Emacs does not continuously recompute each window's mode line and header line. It does so when circumstances appear to call for it—for instance, if you change the window configuration, switch buffers, narrow or widen the buffer, scroll, or modify the buffer.
In other words, you're not going to get a seconds counter in your mode line. When, after open Emacs with no init file (
emacs -Q), I enable
display-time-mode and set up the
display-time-format as above, the mode-line updates as the seconds turn over to
00 and not every second.