From: Stefan Kangas Date: Thu, 22 Apr 2021 18:27:18 +0000 (+0200) Subject: Minor improvements to world-clock X-Git-Tag: emacs-28.0.90~2773 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e860430edc35642bb4aebe919a5231e4d5182d54;p=emacs.git Minor improvements to world-clock * lisp/time.el (world-clock-mode-map): New variable. Bind 'n' and 'p' to 'next-line' and 'previous-line'. (world-clock-update): Preserve point. --- diff --git a/lisp/time.el b/lisp/time.el index 7e1d9180f60..5abc6e948b3 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -525,6 +525,12 @@ If the value is t instead of an alist, use the value of '((t :inherit font-lock-variable-name-face)) "Face for time zone label in `world-clock' buffer.") +(defvar world-clock-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "n" #'next-line) + (define-key map "p" #'previous-line) + map)) + (define-derived-mode world-clock-mode special-mode "World clock" "Major mode for buffer that displays times in various time zones. See `world-clock'." @@ -591,7 +597,9 @@ To turn off the world time display, go to the window and type `\\[quit-window]'. "Update the `world-clock' buffer." (if (get-buffer world-clock-buffer-name) (with-current-buffer (get-buffer world-clock-buffer-name) - (world-clock-display (time--display-world-list))) + (let ((op (point))) + (world-clock-display (time--display-world-list)) + (goto-char op))) (world-clock-cancel-timer))) ;;;###autoload