Hello, On 2025-06-03 08:00, Eli Zaretskii wrote: > 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? I agree, and I think it does make sense. After trying a version with symbols for common use-cases, I think the most flexible option is to allow the user to provide a format for `format-time-string' to act as the sorting key. This is similar in complexity to the variable `world-clock-time-format', and some predefined values can be put in the `:type' block of the `defcustom': #+begin_src emacs-lisp :type '(choice (const :tag "No sorting" nil) (const :tag "Chronological order" "%FT%T") (const :tag "Reverse chronological order" ("%FT%T" . t)) (const :tag "Time of day order" "%T") (const :tag "Reverse time of day order" ("%T" . t)) (string :tag "Format string") (cons :tag "Format string and reverse flag" (string :tag "Format string") (boolean :tag "Reverse")) (function :tag "Sorting function"))) #+end_src Then, sorting can be switched based on the type in a helper function: #+begin_quote (defun world-clock--sort-entries (tzlist time) "Sort TZLIST according to `world-clock-sort-order' at a given TIME." (pcase world-clock-sort-order ((pred null) tzlist) ((or (and (pred stringp) format) `(,(and (pred stringp) format) . ,(and (pred booleanp) reverse))) (sort tzlist :key (lambda (entry) (format-time-string format time (car entry))) :reverse reverse)) ((pred functionp) (funcall world-clock-sort-order tzlist time)) (_ (error "Invalid `world-clock-sort-order': `%s'" world-clock-sort-order)))) #+end_quote In terms of coding standards: + I could do this without `pcase', if desired. + I can write unit tests if we’re okay with the idea. > Please reformat the log message according to our conventions > (described in CONTRIBUTE). Done in the updated patch (I think?). Thank you! -- Jacob S. Gordon jacob.as.gordon@gmail.com ====================== Please avoid sending me HTML emails and MS Office documents. https://useplaintext.email/#etiquette https://www.gnu.org/philosophy/no-word-attachments.html