mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
display-time: Add option to customize help-echo format
This option controls the format of the help-echo when hovering over the time display in mode line. (Bug#80143) * lisp/time.el (display-time-help-echo-format): Add option. (display-time-string-forms): Use it. * etc/NEWS (Time): Announce the new option.
This commit is contained in:
parent
cd152ea611
commit
049eefa611
2 changed files with 20 additions and 1 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -3338,6 +3338,11 @@ each refresh. The sort direction can be controlled by using a cons cell
|
|||
of a format string and a boolean. Alternatively, a sorting function can
|
||||
be provided directly.
|
||||
|
||||
---
|
||||
*** New user option 'display-time-help-echo-format'.
|
||||
This option controls the format of the help echo when hovering over the
|
||||
time.
|
||||
|
||||
** Fill
|
||||
|
||||
+++
|
||||
|
|
|
|||
16
lisp/time.el
16
lisp/time.el
|
|
@ -177,6 +177,18 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
|
|||
:type '(choice (const :tag "Default" nil)
|
||||
string))
|
||||
|
||||
(defcustom display-time-help-echo-format "%a %b %e, %Y"
|
||||
"Format for the help echo when hovering over the time in the mode line.
|
||||
Use the function `customize-variable' to choose a common format, and/or
|
||||
see the function `format-time-string' for an explanation of the syntax."
|
||||
:version "31.1"
|
||||
:type `(choice
|
||||
,@(mapcar #'(lambda (fmt)
|
||||
(list 'const
|
||||
':tag (format-time-string fmt 0 "UTC") fmt))
|
||||
'("%a %b %e, %Y" "%F (%a)" "%a %D"))
|
||||
(string :tag "Format string")))
|
||||
|
||||
(defcustom display-time-string-forms
|
||||
'((if (and (not display-time-format) display-time-day-and-date)
|
||||
(format-time-string "%a %b %e " now)
|
||||
|
|
@ -186,7 +198,9 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'."
|
|||
(if display-time-24hr-format "%H:%M" "%-I:%M%p"))
|
||||
now)
|
||||
'face 'display-time-date-and-time
|
||||
'help-echo (format-time-string "%a %b %e, %Y" now))
|
||||
'help-echo (format-time-string (if (stringp display-time-help-echo-format)
|
||||
display-time-help-echo-format
|
||||
"%a %b %e, %Y") now))
|
||||
load
|
||||
(if mail
|
||||
;; Build the string every time to act on customization.
|
||||
|
|
|
|||
Loading…
Reference in a new issue