diff options
| author | Stefan Kangas | 2021-04-22 20:27:18 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-04-22 20:33:55 +0200 |
| commit | e860430edc35642bb4aebe919a5231e4d5182d54 (patch) | |
| tree | 9a3067e97eb48a78857621968f00b26c81452418 | |
| parent | 61828e55a823640870637c471bc7d62ed1e001a6 (diff) | |
| download | emacs-e860430edc35642bb4aebe919a5231e4d5182d54.tar.gz emacs-e860430edc35642bb4aebe919a5231e4d5182d54.zip | |
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.
| -rw-r--r-- | lisp/time.el | 10 |
1 files changed, 9 insertions, 1 deletions
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 | |||
| 525 | '((t :inherit font-lock-variable-name-face)) | 525 | '((t :inherit font-lock-variable-name-face)) |
| 526 | "Face for time zone label in `world-clock' buffer.") | 526 | "Face for time zone label in `world-clock' buffer.") |
| 527 | 527 | ||
| 528 | (defvar world-clock-mode-map | ||
| 529 | (let ((map (make-sparse-keymap))) | ||
| 530 | (define-key map "n" #'next-line) | ||
| 531 | (define-key map "p" #'previous-line) | ||
| 532 | map)) | ||
| 533 | |||
| 528 | (define-derived-mode world-clock-mode special-mode "World clock" | 534 | (define-derived-mode world-clock-mode special-mode "World clock" |
| 529 | "Major mode for buffer that displays times in various time zones. | 535 | "Major mode for buffer that displays times in various time zones. |
| 530 | See `world-clock'." | 536 | See `world-clock'." |
| @@ -591,7 +597,9 @@ To turn off the world time display, go to the window and type `\\[quit-window]'. | |||
| 591 | "Update the `world-clock' buffer." | 597 | "Update the `world-clock' buffer." |
| 592 | (if (get-buffer world-clock-buffer-name) | 598 | (if (get-buffer world-clock-buffer-name) |
| 593 | (with-current-buffer (get-buffer world-clock-buffer-name) | 599 | (with-current-buffer (get-buffer world-clock-buffer-name) |
| 594 | (world-clock-display (time--display-world-list))) | 600 | (let ((op (point))) |
| 601 | (world-clock-display (time--display-world-list)) | ||
| 602 | (goto-char op))) | ||
| 595 | (world-clock-cancel-timer))) | 603 | (world-clock-cancel-timer))) |
| 596 | 604 | ||
| 597 | ;;;###autoload | 605 | ;;;###autoload |