From: Mark Oteiza <mvoteiza@udel.edu>
To: emacs-devel@gnu.org
Subject: [PATCH] Make display-time-mode time zone configurable
Date: Mon, 15 Feb 2016 17:02:27 -0500 [thread overview]
Message-ID: <87fuwt8wek.fsf@udel.edu> (raw)
* 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
+@vindex 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
next reply other threads:[~2016-02-15 22:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 22:02 Mark Oteiza [this message]
2016-02-16 4:45 ` [PATCH] Make display-time-mode time zone configurable Paul Eggert
2016-02-16 14:33 ` W. Greenhouse
2016-02-16 17:11 ` Paul Eggert
2016-02-19 2:32 ` Mark Oteiza
2016-02-19 2:37 ` Mark Oteiza
2016-02-19 4:57 ` Paul Eggert
2016-02-19 17:14 ` Mark Oteiza
2016-02-19 18:02 ` Paul Eggert
2016-02-22 0:45 ` Mark Oteiza
2016-02-22 5:27 ` Paul Eggert
2016-03-03 0:39 ` Mark Oteiza
2016-03-04 0:24 ` Paul Eggert
-- strict thread matches above, loose matches on Subject: below --
2016-03-04 22:25 Mark Oteiza
2016-03-05 1:35 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fuwt8wek.fsf@udel.edu \
--to=mvoteiza@udel.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.