From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: [PATCH] Make display-time-mode time zone configurable Date: Mon, 15 Feb 2016 17:02:27 -0500 Message-ID: <87fuwt8wek.fsf@udel.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455573782 21994 80.91.229.3 (15 Feb 2016 22:03:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Feb 2016 22:03:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 15 23:02:54 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aVREE-0001Fk-0H for ged-emacs-devel@m.gmane.org; Mon, 15 Feb 2016 23:02:46 +0100 Original-Received: from localhost ([::1]:36627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVRED-0005ev-E8 for ged-emacs-devel@m.gmane.org; Mon, 15 Feb 2016 17:02:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVRE9-0005dI-AY for emacs-devel@gnu.org; Mon, 15 Feb 2016 17:02:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVRE6-0005Ls-5c for emacs-devel@gnu.org; Mon, 15 Feb 2016 17:02:41 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:36896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVRE5-0005Lk-TY for emacs-devel@gnu.org; Mon, 15 Feb 2016 17:02:38 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aVRE2-00014b-C7 for emacs-devel@gnu.org; Mon, 15 Feb 2016 23:02:34 +0100 Original-Received: from pool-96-227-83-242.phlapa.fios.verizon.net ([96.227.83.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2016 23:02:34 +0100 Original-Received: from mvoteiza by pool-96-227-83-242.phlapa.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2016 23:02:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 87 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pool-96-227-83-242.phlapa.fios.verizon.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:yW3adylp0XnBsnLdP51GLdv/g5M= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199995 Archived-At: * 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