diff options
Diffstat (limited to 'lisp/time.el')
-rw-r--r-- | lisp/time.el | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/time.el b/lisp/time.el index 1403c4ac00a..9f25f99a149 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -205,7 +205,8 @@ depend on `display-time-day-and-date' and `display-time-24hr-format'." 'mouse-face 'mode-line-highlight 'local-map (make-mode-line-mouse-map 'mouse-2 read-mail-command))) - "")) + "") + " ") "List of expressions governing display of the time in the mode line. For most purposes, you can control the time format using `display-time-format' which is a more standard interface. @@ -525,9 +526,16 @@ 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'." + :interactive nil (setq-local revert-buffer-function #'world-clock-update) (setq show-trailing-whitespace nil)) @@ -591,7 +599,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 @@ -614,13 +624,14 @@ point." str)))) ;;;###autoload -(defun emacs-init-time () - "Return a string giving the duration of the Emacs initialization." +(defun emacs-init-time (&optional format) + "Return a string giving the duration of the Emacs initialization. +FORMAT is a string to format the result, using `format'. If nil, +the default format \"%f seconds\" is used." (interactive) - (let ((str - (format "%s seconds" - (float-time - (time-subtract after-init-time before-init-time))))) + (let ((str (format (or format "%f seconds") + (float-time (time-subtract after-init-time + before-init-time))))) (if (called-interactively-p 'interactive) (message "%s" str) str))) |