emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e860430: Minor improvements to world-clock


From: Stefan Kangas
Subject: master e860430: Minor improvements to world-clock
Date: Thu, 22 Apr 2021 14:34:01 -0400 (EDT)

branch: master
commit e860430edc35642bb4aebe919a5231e4d5182d54
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 lisp/time.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/time.el b/lisp/time.el
index 7e1d918..5abc6e9 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]