GNU bug report logs - #78678
[PATCH v1] world-clock: Sort entries based on a user-provided function

Previous Next

Package: emacs;

Reported by: "Jacob S. Gordon" <jacob.as.gordon <at> gmail.com>

Date: Tue, 3 Jun 2025 06:32:06 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #8 received at 78678 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "Jacob S. Gordon" <jacob.as.gordon <at> gmail.com>
Cc: 78678 <at> debbugs.gnu.org
Subject: Re: bug#78678: [PATCH v1] world-clock: Sort entries based on a
 user-provided function
Date: Tue, 03 Jun 2025 15:00:34 +0300
> From: "Jacob S. Gordon" <jacob.as.gordon <at> gmail.com>
> Date: Tue, 03 Jun 2025 02:30:59 -0400
> 
> Please find below a feature proposal for sorting entries of
> world-clock, and a first draft of a patch attached to this message.
> 
> # Motivation
> 
> The `world-clock' displays time zone entries in the order they appear
> in `world-clock-list'. Usually this is enough, since orders like time
> can often be done statically. However, there are scenarios where you
> might want a dynamic ordering. For example:
> 
> 1. You work with people in multiple time zones, and you want entries
> to appear in order of proximity to working hours, e.g. in what time
> zones are people likely to be responsive right now?
> 
> 2. Daylight savings can go into effect at [different times]. For
> example, eastern Europe and Egypt both shift from UTC+2 in the winter
> to UTC+3 in the summer.

I have no objections to adding such a feature.

> A simple way to do this is with a `world-clock-sort-function' custom
> variable that sorts the entries in `world-clock-display'.
> 
> #+begin_src emacs-lisp
> (setopt world-clock-sort-function 'my/world-clock-sort-function)
> #+end_src
> 
> You could then accomplish each of the orderings mentioned earlier:

This requires users to be Lisp programmers.  If there are
reasonably-useful cases where a certain order would be desirable,
allowing users to customize a variable using symbol values makes the
feature much more friendly to users who are not programmers.  Would it
make sense to add a couple of such values?

> >From 0d293d92d81d1086a63942734fa067c4f0ca0bfe Mon Sep 17 00:00:00 2001
> From: "Jacob S. Gordon" <jacob.as.gordon <at> gmail.com>
> Date: Mon, 2 Jun 2025 21:06:37 -0400
> 
> The 'world-clock' displays time zone entries in the order they appear in
> 'world-clock-list' (or a default if unset).  We introduce a custom
> variable 'world-clock-sort-function' to generate an order on each update
> of 'world-clock-display'.  The default value of 'identity' preserves the
> existing behavior.
> 
> * lisp/time.el (world-clock-sort-function, world-clock-display):
> 
> Add custom variable 'world-clock-sort-function', and sort time zone
> entries in 'world-clock-display' according to it.

Please reformat the log message according to our conventions
(described in CONTRIBUTE).

> +** Time
> +
> +*** New user option 'world-clock-sort-function'

The heading lines in NEWS should end with a period.

Thanks.




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.