[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Make display-time-mode time zone configurable
From: |
Mark Oteiza |
Subject: |
[PATCH] Make display-time-mode time zone configurable |
Date: |
Mon, 15 Feb 2016 17:02:27 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
* lisp/time.el (display-time-zone): New custom variable.
(display-time-string-forms): Use it.
* doc/emacs/display.texi: Mention and index display-time-zone.
* etc/NEWS: Mention display-time-zone.
---
Looking for feedback: format-time-string has new ZONE argument--would be
good if display-time-mode were able to use it.
doc/emacs/display.texi | 5 ++++-
etc/NEWS | 3 +++
lisp/time.el | 17 ++++++++++++++---
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index e3b2403..fafe188 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1342,13 +1342,16 @@ line looks like this:
@noindent
@vindex display-time-24hr-format
address@hidden display-time-zone
Here @var{hh} and @var{mm} are the hour and minute, followed always by
@samp{am} or @samp{pm}. @var{l.ll} is the average number, collected
for the last few minutes, of processes in the whole system that were
either running or ready to run (i.e., were waiting for an available
processor). (Some fields may be missing if your operating system
cannot support them.) If you prefer time display in 24-hour format,
-set the variable @code{display-time-24hr-format} to @code{t}.
+set the variable @code{display-time-24hr-format} to @code{t}. The
+time zone can be configured with @code{display-time-zone}, which
+corresponds to the @var{zone} argument of @code{format-time-string}.
@cindex mail (on mode line)
@vindex display-time-use-mail-icon
diff --git a/etc/NEWS b/etc/NEWS
index f4ea3a0..1ac1a78 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1753,6 +1753,9 @@ been obsoleted.
undocumented integer-pair format. Instead, they return a list of two
integers.
+*** New option `display-time-zone' for specifying time conversion
+in `display-time-mode'. This is used as ZONE in `format-time-string'.
+
+++
** New function `set-binary-mode' allows switching a standard stream
of the Emacs process to binary I/O mode.
diff --git a/lisp/time.el b/lisp/time.el
index e0d39b1..d5e6ee9 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -259,15 +259,26 @@ depend on `display-time-day-and-date' and
`display-time-24hr-format'."
string)
:group 'display-time)
+(defcustom display-time-zone nil
+ "Variable specifying the time zone used in `display-time-string-forms'.
+See the function `format-time-string' for an explanation of
+its ZONE variable."
+ :type '(choice (const :tag "Emacs Local Time" nil)
+ (const :tag "Universal Time" t)
+ (const :tag "System Wall Clock Time" wall)
+ (string "Time Zone Rule"))
+ :link '(function-link format-time-string)
+ :group 'display-time)
+
(defcustom display-time-string-forms
'((if (and (not display-time-format) display-time-day-and-date)
- (format-time-string "%a %b %e " now)
+ (format-time-string "%a %b %e " now display-time-zone)
"")
(propertize
(format-time-string (or display-time-format
(if display-time-24hr-format "%H:%M" "%-I:%M%p"))
- now)
- 'help-echo (format-time-string "%a %b %e, %Y" now))
+ now display-time-zone)
+ 'help-echo (format-time-string "%a %b %e, %Y" now display-time-zone))
load
(if mail
;; Build the string every time to act on customization.
--
2.7.1
- [PATCH] Make display-time-mode time zone configurable,
Mark Oteiza <=
- Re: [PATCH] Make display-time-mode time zone configurable, Paul Eggert, 2016/02/15
- Re: [PATCH] Make display-time-mode time zone configurable, Mark Oteiza, 2016/02/18
- Re: [PATCH] Make display-time-mode time zone configurable, Paul Eggert, 2016/02/18
- Re: [PATCH] Make display-time-mode time zone configurable, Mark Oteiza, 2016/02/19
- Re: [PATCH] Make display-time-mode time zone configurable, Paul Eggert, 2016/02/19
- Re: [PATCH] Make display-time-mode time zone configurable, Mark Oteiza, 2016/02/21
- Re: [PATCH] Make display-time-mode time zone configurable, Paul Eggert, 2016/02/22