all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [PATCH] Make display-time-mode time zone configurable
@ 2016-03-04 22:25 Mark Oteiza
  2016-03-05  1:35 ` Paul Eggert
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Oteiza @ 2016-03-04 22:25 UTC (permalink / raw)
  To: emacs-devel; +Cc: Paul Eggert

Paul Eggert <eggert@cs.ucla.edu> writes:

> On 03/02/2016 04:39 PM, Mark Oteiza wrote:
>>
>>> I'm afraid we're starting to go in circles. I'm curious about why
>>> one would want to change just the mode-line's time zone, and you're
>>> responding that it's because one would want to change just the
>>> mode-line's time zone. :-) 
>> You are repeatedly responding to the use case with the non-solution of
>> setting the time zone globally in Emacs.
>
> Yes, we are indeed going around in circles. The problem is that I
> haven't seen a real use case yet.

To me it seems you have simply dismissed the use cases already
mentioned.

> We already have a solution for an expert who for some reason needs a
> mode line in a different time zone from the Emacs default. As I
> understand it, you're asking to complicate Emacs by adding a feature
> to make it easier to configure Emacs to have this unusual behavior, so
> that a non-expert can more easily arrange for Emacs mode lines to be
> in the "wrong" time zone. My problem is that I don't understand why a
> non-expert would want to do that. And without understanding the actual
> need, it's hard to see why the proposed feature's benefits would be
> worth its costs.

Where "wrong" simply means not the emacs default. In time-stamp.el it is
considered worthwhile having the option to standardize time stamps in a
particular non-default time zone. It is not unusual for a system to be
configured to the "wrong" time zone (perhaps UTC), and it would be nice to
have the mode line clock show the "right" time.

Changing a single option is far less annoying than changing a sprawling
sexp, so it will be easier for experts and non-experts alike. I'm not
sure how expertise is relevant.



^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH] Make display-time-mode time zone configurable
@ 2016-02-15 22:02 Mark Oteiza
  2016-02-16  4:45 ` Paul Eggert
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Oteiza @ 2016-02-15 22:02 UTC (permalink / raw)
  To: emacs-devel


* 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





^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-03-05  1:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 22:25 [PATCH] Make display-time-mode time zone configurable Mark Oteiza
2016-03-05  1:35 ` Paul Eggert
  -- strict thread matches above, loose matches on Subject: below --
2016-02-15 22:02 Mark Oteiza
2016-02-16  4:45 ` 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

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.