diff options
Diffstat (limited to 'lisp/time.el')
-rw-r--r-- | lisp/time.el | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lisp/time.el b/lisp/time.el index 302a8c7cd73..006fd758a7c 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -454,8 +454,9 @@ update which can wait for the next redisplay." (force-mode-line-update)) (defun display-time-file-nonempty-p (file) - (and (file-exists-p file) - (< 0 (nth 7 (file-attributes (file-chase-links file)))))) + (let ((remote-file-name-inhibit-cache (- display-time-interval 5))) + (and (file-exists-p file) + (< 0 (nth 7 (file-attributes (file-chase-links file))))))) ;;;###autoload (define-minor-mode display-time-mode @@ -490,15 +491,10 @@ This runs the normal hook `display-time-hook' after each update." 'display-time-event-handler))) -(defun display-time-world-mode () +(define-derived-mode display-time-world-mode nil "World clock" "Major mode for buffer that displays times in various time zones. See `display-time-world'." - (interactive) - (kill-all-local-variables) - (setq - major-mode 'display-time-world-mode - mode-name "World clock") - (use-local-map display-time-world-mode-map)) + (setq show-trailing-whitespace nil)) (defun display-time-world-display (alist) "Replace current buffer text with times in various zones, based on ALIST." @@ -506,25 +502,23 @@ See `display-time-world'." (buffer-undo-list t)) (erase-buffer) (let ((max-width 0) - (result ())) + (result ()) + fmt) (unwind-protect (dolist (zone alist) (let* ((label (cadr zone)) (width (string-width label))) (set-time-zone-rule (car zone)) - (setq result - (append result - (list - label width - (format-time-string display-time-world-time-format)))) + (push (cons label + (format-time-string display-time-world-time-format)) + result) (when (> width max-width) (setq max-width width)))) (set-time-zone-rule nil)) - (while result - (insert (pop result) - (make-string (1+ (- max-width (pop result))) ?\s) - (pop result) "\n"))) - (delete-backward-char 1))) + (setq fmt (concat "%-" (int-to-string max-width) "s %s\n")) + (dolist (timedata (nreverse result)) + (insert (format fmt (car timedata) (cdr timedata))))) + (delete-char -1))) ;;;###autoload (defun display-time-world () |