2020-10-21 15:00:11 +00:00
|
|
|
|
;;; time.el --- display time, load and mail indicator in mode line of Emacs -*- lexical-binding: t -*-
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
|
;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2024 Free Software
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Foundation, Inc.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2019-05-25 20:43:06 +00:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-17 15:36:33 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; Facilities to display current time/date and a new-mail indicator
|
2007-08-28 15:06:43 +00:00
|
|
|
|
;; in the Emacs mode line. The entry point is `display-time'.
|
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
;; Use `world-clock' to display world clock in a buffer.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2020-09-03 15:19:15 +00:00
|
|
|
|
(eval-when-compile (require 'subr-x))
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defgroup display-time nil
|
|
|
|
|
"Display time and load in mode line of Emacs."
|
2006-09-14 23:54:12 +00:00
|
|
|
|
:group 'mode-line
|
2000-06-17 15:36:33 +00:00
|
|
|
|
:group 'mail)
|
|
|
|
|
|
|
|
|
|
(defcustom display-time-mail-file nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"File name of mail inbox file, for indicating existence of new mail.
|
2007-05-16 14:08:48 +00:00
|
|
|
|
Non-nil and not a string means don't check for mail; nil means use
|
2000-06-17 15:36:33 +00:00
|
|
|
|
default, which is system-dependent, and is the same as used by Rmail."
|
2002-09-15 01:51:49 +00:00
|
|
|
|
:type '(choice (const :tag "None" none)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(const :tag "Default" nil)
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
(file :format "%v")))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2002-01-27 18:14:55 +00:00
|
|
|
|
(defcustom display-time-mail-directory nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Name of mail inbox directory, for indicating existence of new mail.
|
2002-04-30 17:56:19 +00:00
|
|
|
|
Any nonempty regular file in the directory is regarded as newly arrived mail.
|
|
|
|
|
If nil, do not check a directory for arriving mail."
|
2002-01-27 18:14:55 +00:00
|
|
|
|
:type '(choice (const :tag "None" nil)
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
(directory :format "%v")))
|
2002-01-27 18:14:55 +00:00
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defcustom display-time-mail-function nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Function to call, for indicating existence of new mail.
|
2002-04-30 17:56:19 +00:00
|
|
|
|
If nil, that means use the default method: check that the file
|
|
|
|
|
specified by `display-time-mail-file' is nonempty or that the
|
|
|
|
|
directory `display-time-mail-directory' contains nonempty files."
|
2000-06-17 15:36:33 +00:00
|
|
|
|
:type '(choice (const :tag "Default" nil)
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
(function)))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2001-12-22 09:18:01 +00:00
|
|
|
|
(defcustom display-time-default-load-average 0
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Which load average value will be shown in the mode line.
|
2012-01-06 09:43:59 +00:00
|
|
|
|
Almost every system can provide values of load for the past 1 minute,
|
|
|
|
|
past 5 or past 15 minutes. The default is to display 1-minute load average.
|
2009-03-21 18:53:14 +00:00
|
|
|
|
The value can be one of:
|
|
|
|
|
|
|
|
|
|
0 => 1 minute load
|
|
|
|
|
1 => 5 minutes load
|
2012-01-06 09:43:59 +00:00
|
|
|
|
2 => 15 minutes load
|
|
|
|
|
nil => None (do not display the load average)"
|
2001-12-22 09:18:01 +00:00
|
|
|
|
:type '(choice (const :tag "1 minute load" 0)
|
|
|
|
|
(const :tag "5 minutes load" 1)
|
2002-09-15 01:51:49 +00:00
|
|
|
|
(const :tag "15 minutes load" 2)
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
(const :tag "None" nil)))
|
2001-12-22 09:18:01 +00:00
|
|
|
|
|
2002-09-15 01:51:49 +00:00
|
|
|
|
(defvar display-time-load-average nil
|
2012-01-06 09:43:59 +00:00
|
|
|
|
"Value of the system's load average currently shown on the mode line.
|
|
|
|
|
See `display-time-default-load-average'.
|
|
|
|
|
|
|
|
|
|
This is an internal variable; setting it has no effect.")
|
2001-12-22 09:18:01 +00:00
|
|
|
|
|
|
|
|
|
(defcustom display-time-load-average-threshold 0.1
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Load-average values below this value won't be shown in the mode line."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type 'number)
|
2001-12-22 09:18:01 +00:00
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defcustom display-time-day-and-date nil "\
|
2010-07-19 10:42:22 +00:00
|
|
|
|
Non-nil means \\[display-time] should display day and date as well as time."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type 'boolean)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defvar display-time-timer nil)
|
|
|
|
|
|
|
|
|
|
(defcustom display-time-interval 60
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Seconds between updates of time in the mode line."
|
Make some defcustom types more restrictive
* lisp/abbrev.el (abbrev-suggest-hint-threshold):
* lisp/bookmark.el (bookmark-bmenu-file-column)
(bookmark-menu-length):
* lisp/buff-menu.el (Buffer-menu-size-width)
(Buffer-menu-mode-width):
* lisp/calendar/calendar.el (calendar-week-start-day)
(calendar-intermonth-spacing, calendar-column-width)
(calendar-day-digit-width):
* lisp/calc/calc.el (calc-undo-length):
* lisp/calendar/timeclock.el (timeclock-workday):
* lisp/comint.el (comint-buffer-maximum-size)
(comint-input-ring-size):
* lisp/doc-view.el (doc-view-resolution, doc-view-image-width):
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column):
* lisp/emacs-lisp/comp.el (native-comp-debug)
(native-comp-verbose, native-comp-async-jobs-number):
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width):
* lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines):
* lisp/frame.el (blink-cursor-blinks):
* lisp/info.el (Info-breadcrumbs-depth):
* lisp/jit-lock.el (jit-lock-chunk-size):
* lisp/kmacro.el (kmacro-ring-max):
* lisp/menu-bar.el (yank-menu-length, yank-menu-max-items):
* lisp/midnight.el (clean-buffer-list-delay-general)
(clean-buffer-list-delay-special):
* lisp/net/dictionary.el (dictionary-port)
(dictionary-proxy-port):
* lisp/net/ldap.el (ldap-default-port):
* lisp/net/pop3.el (pop3-port, pop3-stream-length):
* lisp/net/rcirc.el (rcirc-default-port):
* lisp/net/sieve-manage.el (sieve-manage-default-port):
* lisp/play/spook.el (spook-phrase-default-count):
* lisp/play/tetris.el (tetris-buffer-width)
(tetris-buffer-height, tetris-width, tetris-height)
(tetris-top-left-x, tetris-top-left-y):
* lisp/profiler.el (profiler-sampling-interval):
* lisp/progmodes/sql.el (sql-port):
* lisp/recentf.el (recentf-max-menu-items):
* lisp/strokes.el (strokes-grid-resolution):
* lisp/tab-bar.el (tab-bar-tab-name-truncated-max):
* lisp/term/xterm.el (xterm-max-cut-length):
* lisp/time.el (display-time-interval, world-clock-timer-second):
* lisp/url/url-cache.el (url-cache-expire-time):
* lisp/url/url-cookie.el (url-cookie-save-interval):
* lisp/url/url-history.el (url-history-save-interval):
* lisp/url/url-queue.el (url-queue-parallel-processes)
(url-queue-timeout):
* lisp/url/url-vars.el (url-max-password-attempts)
(url-max-redirections):
* lisp/vc/emerge.el (emerge-min-visible-lines):
* lisp/vc/vc.el (vc-log-show-limit):
* lisp/window.el (window-min-height, window-min-width):
* lisp/winner.el (winner-ring-size): Use :type natnum.
* lisp/savehist.el (savehist-file-modes): Fix setting to nil value and
use :type natnum.
2022-07-05 14:26:45 +00:00
|
|
|
|
:type 'natnum)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defcustom display-time-24hr-format nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil indicates time should be displayed as hh:mm, 0 <= hh <= 23.
|
2007-05-16 11:27:37 +00:00
|
|
|
|
A value of nil means 1 <= hh <= 12, and an AM/PM suffix is used."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type 'boolean)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2016-04-30 20:41:41 +00:00
|
|
|
|
(defvar display-time-string nil
|
|
|
|
|
"String used in mode lines to display a time string.
|
|
|
|
|
It should not be set directly, but is instead updated by the
|
|
|
|
|
`display-time' function.")
|
2009-08-26 03:07:25 +00:00
|
|
|
|
;;;###autoload(put 'display-time-string 'risky-local-variable t)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defcustom display-time-hook nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"List of functions to be called when the time is updated on the mode line."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type 'hook)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defvar display-time-server-down-time nil
|
|
|
|
|
"Time when mail file's file system was recorded to be down.
|
|
|
|
|
If that file system seems to be up, the value is nil.")
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun display-time ()
|
|
|
|
|
"Enable display of time, load level, and mail flag in mode lines.
|
|
|
|
|
This display updates automatically every minute.
|
|
|
|
|
If `display-time-day-and-date' is non-nil, the current day and date
|
|
|
|
|
are displayed as well.
|
|
|
|
|
This runs the normal hook `display-time-hook' after each update."
|
|
|
|
|
(interactive)
|
|
|
|
|
(display-time-mode 1))
|
|
|
|
|
|
2003-04-01 18:03:13 +00:00
|
|
|
|
;; This business used to be simpler when all mode lines had the same
|
|
|
|
|
;; face and the image could just be pbm. Now we try to rely on an xpm
|
|
|
|
|
;; image with a transparent background. Otherwise, set the background
|
|
|
|
|
;; for pbm.
|
|
|
|
|
|
|
|
|
|
(defcustom display-time-mail-face nil
|
2000-06-17 15:36:33 +00:00
|
|
|
|
"Face to use for `display-time-mail-string'.
|
2003-04-01 18:03:13 +00:00
|
|
|
|
If `display-time-use-mail-icon' is non-nil, the image's
|
2005-06-10 14:08:19 +00:00
|
|
|
|
background color is the background of this face. Set this to
|
|
|
|
|
make the mail indicator stand out on a color display."
|
2006-01-16 23:55:25 +00:00
|
|
|
|
:group 'mode-line-faces
|
2000-06-17 15:36:33 +00:00
|
|
|
|
:group 'display-time
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1"
|
2003-04-01 18:03:13 +00:00
|
|
|
|
:type '(choice (const :tag "None" nil) face))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2023-07-20 17:12:32 +00:00
|
|
|
|
(defface display-time-date-and-time
|
2023-07-22 06:13:35 +00:00
|
|
|
|
'((t nil))
|
2023-07-20 17:12:32 +00:00
|
|
|
|
"Face for `display-time-format'."
|
2023-02-16 09:05:53 +00:00
|
|
|
|
:group 'mode-line-faces
|
|
|
|
|
:version "30.1")
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defvar display-time-mail-icon
|
2002-01-27 18:14:55 +00:00
|
|
|
|
(find-image '((:type xpm :file "letter.xpm" :ascent center)
|
2003-04-01 18:03:13 +00:00
|
|
|
|
(:type pbm :file "letter.pbm" :ascent center)))
|
|
|
|
|
"Image specification to offer as the mail indicator on a graphic display.
|
|
|
|
|
See `display-time-use-mail-icon' and `display-time-mail-face'.")
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2003-04-01 18:03:13 +00:00
|
|
|
|
;; Fixme: Default to icon on graphical display?
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defcustom display-time-use-mail-icon nil
|
2005-08-11 01:53:17 +00:00
|
|
|
|
"Non-nil means use an icon as mail indicator on a graphic display.
|
2003-04-01 18:03:13 +00:00
|
|
|
|
Otherwise use `display-time-mail-string'. The icon may consume less
|
|
|
|
|
of the mode line. It is specified by `display-time-mail-icon'."
|
2000-06-17 15:36:33 +00:00
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
2003-04-01 18:03:13 +00:00
|
|
|
|
;; Fixme: maybe default to the character if we can display Unicode.
|
|
|
|
|
(defcustom display-time-mail-string "Mail"
|
|
|
|
|
"String to use as the mail indicator in `display-time-string-forms'.
|
|
|
|
|
This can use the Unicode letter character if you can display it."
|
2005-02-09 15:50:47 +00:00
|
|
|
|
:version "22.1"
|
2003-04-01 18:03:13 +00:00
|
|
|
|
:type '(choice (const "Mail")
|
|
|
|
|
;; Use :tag here because the Lucid menu won't display
|
|
|
|
|
;; multibyte text.
|
|
|
|
|
(const :tag "Unicode letter character" "✉")
|
|
|
|
|
string))
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defcustom display-time-format nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"String specifying format for displaying the time in the mode line.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
See the function `format-time-string' for an explanation of
|
|
|
|
|
how to write this string. If this is nil, the defaults
|
|
|
|
|
depend on `display-time-day-and-date' and `display-time-24hr-format'."
|
|
|
|
|
:type '(choice (const :tag "Default" nil)
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
string))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defcustom display-time-string-forms
|
|
|
|
|
'((if (and (not display-time-format) display-time-day-and-date)
|
|
|
|
|
(format-time-string "%a %b %e " now)
|
|
|
|
|
"")
|
2004-03-19 02:34:39 +00:00
|
|
|
|
(propertize
|
|
|
|
|
(format-time-string (or display-time-format
|
|
|
|
|
(if display-time-24hr-format "%H:%M" "%-I:%M%p"))
|
|
|
|
|
now)
|
2023-02-18 07:36:18 +00:00
|
|
|
|
'face 'display-time-date-and-time
|
2004-03-23 07:43:10 +00:00
|
|
|
|
'help-echo (format-time-string "%a %b %e, %Y" now))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
load
|
|
|
|
|
(if mail
|
|
|
|
|
;; Build the string every time to act on customization.
|
2003-04-01 18:03:13 +00:00
|
|
|
|
;; :set-after doesn't help for `customize-option'. I think it
|
|
|
|
|
;; should.
|
|
|
|
|
(concat
|
|
|
|
|
" "
|
|
|
|
|
(propertize
|
|
|
|
|
display-time-mail-string
|
|
|
|
|
'display `(when (and display-time-use-mail-icon
|
|
|
|
|
(display-graphic-p))
|
|
|
|
|
,@display-time-mail-icon
|
|
|
|
|
,@(if (and display-time-mail-face
|
|
|
|
|
(memq (plist-get (cdr display-time-mail-icon)
|
|
|
|
|
:type)
|
|
|
|
|
'(pbm xbm)))
|
|
|
|
|
(let ((bg (face-attribute display-time-mail-face
|
|
|
|
|
:background)))
|
|
|
|
|
(if (stringp bg)
|
|
|
|
|
(list :background bg)))))
|
|
|
|
|
'face display-time-mail-face
|
|
|
|
|
'help-echo "You have new mail; mouse-2: Read mail"
|
2005-05-26 20:43:39 +00:00
|
|
|
|
'mouse-face 'mode-line-highlight
|
2003-04-01 18:03:13 +00:00
|
|
|
|
'local-map (make-mode-line-mouse-map 'mouse-2
|
|
|
|
|
read-mail-command)))
|
2021-07-23 12:40:53 +00:00
|
|
|
|
"")
|
|
|
|
|
" ")
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"List of expressions governing display of the time in the mode line.
|
2000-06-17 15:36:33 +00:00
|
|
|
|
For most purposes, you can control the time format using `display-time-format'
|
|
|
|
|
which is a more standard interface.
|
|
|
|
|
|
|
|
|
|
This expression is a list of expressions that can involve the keywords
|
|
|
|
|
`load', `day', `month', and `year', `12-hours', `24-hours', `minutes',
|
|
|
|
|
`seconds', all numbers in string form, and `monthname', `dayname', `am-pm',
|
|
|
|
|
and `time-zone' all alphabetic strings, and `mail' a true/nil value.
|
|
|
|
|
|
2016-12-07 19:29:54 +00:00
|
|
|
|
For example:
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2016-12-07 19:29:54 +00:00
|
|
|
|
((substring year -2) \"/\" month \"/\" day
|
2000-06-17 15:36:33 +00:00
|
|
|
|
\" \" 24-hours \":\" minutes \":\" seconds
|
|
|
|
|
(if time-zone \" (\") time-zone (if time-zone \")\")
|
|
|
|
|
(if mail \" Mail\" \"\"))
|
|
|
|
|
|
|
|
|
|
would give mode line times like `94/12/30 21:07:48 (UTC)'."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type '(repeat sexp))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defun display-time-event-handler ()
|
|
|
|
|
(display-time-update)
|
|
|
|
|
(let* ((current (current-time))
|
|
|
|
|
(timer display-time-timer)
|
|
|
|
|
;; Compute the time when this timer will run again, next.
|
|
|
|
|
(next-time (timer-relative-time
|
|
|
|
|
(list (aref timer 1) (aref timer 2) (aref timer 3))
|
|
|
|
|
(* 5 (aref timer 4)) 0)))
|
2018-09-25 02:13:34 +00:00
|
|
|
|
;; If the activation time is not in the future,
|
2000-06-17 15:36:33 +00:00
|
|
|
|
;; skip executions until we reach a time in the future.
|
|
|
|
|
;; This avoids a long pause if Emacs has been suspended for hours.
|
2018-09-25 02:13:34 +00:00
|
|
|
|
(or (time-less-p current next-time)
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(progn
|
|
|
|
|
(timer-set-time timer (timer-next-integral-multiple-of-time
|
|
|
|
|
current display-time-interval)
|
|
|
|
|
display-time-interval)
|
|
|
|
|
(timer-activate timer)))))
|
|
|
|
|
|
2001-12-22 09:18:01 +00:00
|
|
|
|
(defun display-time-next-load-average ()
|
2012-01-06 07:45:55 +00:00
|
|
|
|
"Switch between different load averages in the mode line.
|
|
|
|
|
Switches from the 1 to 5 to 15 minute load average, and then back to 1."
|
2001-12-22 09:18:01 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (= 3 (setq display-time-load-average (1+ display-time-load-average)))
|
|
|
|
|
(setq display-time-load-average 0))
|
2013-08-09 18:49:36 +00:00
|
|
|
|
(display-time-update))
|
2001-12-22 09:18:01 +00:00
|
|
|
|
|
2002-01-27 18:14:55 +00:00
|
|
|
|
(defun display-time-mail-check-directory ()
|
|
|
|
|
(let ((mail-files (directory-files display-time-mail-directory t))
|
|
|
|
|
(size 0))
|
|
|
|
|
(while (and mail-files (= size 0))
|
|
|
|
|
;; Count size of regular files only.
|
|
|
|
|
(setq size (+ size (or (and (file-regular-p (car mail-files))
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
|
(file-attribute-size
|
|
|
|
|
(file-attributes (car mail-files))))
|
2002-01-27 18:14:55 +00:00
|
|
|
|
0)))
|
|
|
|
|
(setq mail-files (cdr mail-files)))
|
|
|
|
|
(if (> size 0)
|
|
|
|
|
size
|
|
|
|
|
nil)))
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(with-no-warnings
|
2011-12-04 08:02:42 +00:00
|
|
|
|
;; Warnings are suppressed to avoid "global/dynamic var `X' lacks a prefix".
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defvar now)
|
|
|
|
|
(defvar time)
|
|
|
|
|
(defvar load)
|
|
|
|
|
(defvar mail)
|
|
|
|
|
(defvar 24-hours)
|
|
|
|
|
(defvar hour)
|
|
|
|
|
(defvar 12-hours)
|
|
|
|
|
(defvar am-pm)
|
|
|
|
|
(defvar minutes)
|
|
|
|
|
(defvar seconds)
|
|
|
|
|
(defvar time-zone)
|
|
|
|
|
(defvar day)
|
|
|
|
|
(defvar year)
|
|
|
|
|
(defvar monthname)
|
|
|
|
|
(defvar month)
|
|
|
|
|
(defvar dayname))
|
|
|
|
|
|
2020-10-21 14:59:50 +00:00
|
|
|
|
(defun display-time-update--load ()
|
|
|
|
|
(if (null display-time-load-average)
|
|
|
|
|
""
|
|
|
|
|
(condition-case ()
|
|
|
|
|
;; Do not show values less than
|
|
|
|
|
;; `display-time-load-average-threshold'.
|
|
|
|
|
(if (> (* display-time-load-average-threshold 100)
|
|
|
|
|
(nth display-time-load-average (load-average)))
|
|
|
|
|
""
|
|
|
|
|
;; The load average number is mysterious, so
|
|
|
|
|
;; provide some help.
|
|
|
|
|
(let ((str (format " %03d"
|
|
|
|
|
(nth display-time-load-average
|
|
|
|
|
(load-average)))))
|
|
|
|
|
(propertize
|
|
|
|
|
(concat (substring str 0 -2) "." (substring str -2))
|
|
|
|
|
'local-map (make-mode-line-mouse-map
|
|
|
|
|
'mouse-2 'display-time-next-load-average)
|
|
|
|
|
'mouse-face 'mode-line-highlight
|
|
|
|
|
'help-echo (concat
|
|
|
|
|
"System load average for past "
|
|
|
|
|
(if (= 0 display-time-load-average)
|
|
|
|
|
"1 minute"
|
|
|
|
|
(if (= 1 display-time-load-average)
|
|
|
|
|
"5 minutes"
|
|
|
|
|
"15 minutes"))
|
|
|
|
|
"; mouse-2: next"))))
|
|
|
|
|
(error ""))))
|
|
|
|
|
|
|
|
|
|
(defun display-time-update--mail ()
|
|
|
|
|
(let ((mail-spool-file (or display-time-mail-file
|
|
|
|
|
(getenv "MAIL")
|
|
|
|
|
(concat rmail-spool-directory
|
|
|
|
|
(user-login-name)))))
|
|
|
|
|
(cond
|
|
|
|
|
(display-time-mail-function
|
|
|
|
|
(funcall display-time-mail-function))
|
|
|
|
|
(display-time-mail-directory
|
|
|
|
|
(display-time-mail-check-directory))
|
|
|
|
|
((and (stringp mail-spool-file)
|
|
|
|
|
(or (null display-time-server-down-time)
|
|
|
|
|
;; If have been down for 20 min, try again.
|
|
|
|
|
(time-less-p 1200 (time-since
|
|
|
|
|
display-time-server-down-time))))
|
|
|
|
|
(let ((start-time (current-time)))
|
|
|
|
|
(prog1
|
|
|
|
|
(display-time-file-nonempty-p mail-spool-file)
|
|
|
|
|
;; Record whether mail file is accessible.
|
|
|
|
|
(setq display-time-server-down-time
|
|
|
|
|
(let ((end-time (current-time)))
|
|
|
|
|
(and (time-less-p 20 (time-subtract
|
|
|
|
|
end-time start-time))
|
|
|
|
|
(float-time end-time))))))))))
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(defun display-time-update ()
|
2021-09-14 06:43:18 +00:00
|
|
|
|
"Update the `display-time' info for the mode line.
|
2003-04-01 18:03:13 +00:00
|
|
|
|
However, don't redisplay right now.
|
|
|
|
|
|
2021-11-22 10:45:44 +00:00
|
|
|
|
This is used for things like Rmail \\`g' that want to force an
|
2003-04-01 18:03:13 +00:00
|
|
|
|
update which can wait for the next redisplay."
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(let* ((now (current-time))
|
2020-10-21 14:59:50 +00:00
|
|
|
|
(time (current-time-string now))
|
|
|
|
|
(load (display-time-update--load))
|
|
|
|
|
(mail (display-time-update--mail))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(24-hours (substring time 11 13))
|
2005-05-16 11:34:49 +00:00
|
|
|
|
(hour (string-to-number 24-hours))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(12-hours (int-to-string (1+ (% (+ hour 11) 12))))
|
|
|
|
|
(am-pm (if (>= hour 12) "pm" "am"))
|
|
|
|
|
(minutes (substring time 14 16))
|
|
|
|
|
(seconds (substring time 17 19))
|
2021-12-16 17:40:22 +00:00
|
|
|
|
(time-zone (format-time-string "%Z" now))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(day (substring time 8 10))
|
2012-05-04 06:13:18 +00:00
|
|
|
|
(year (format-time-string "%Y" now))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(monthname (substring time 4 7))
|
|
|
|
|
(month
|
|
|
|
|
(cdr
|
|
|
|
|
(assoc
|
|
|
|
|
monthname
|
|
|
|
|
'(("Jan" . "1") ("Feb" . "2") ("Mar" . "3") ("Apr" . "4")
|
|
|
|
|
("May" . "5") ("Jun" . "6") ("Jul" . "7") ("Aug" . "8")
|
|
|
|
|
("Sep" . "9") ("Oct" . "10") ("Nov" . "11") ("Dec" . "12")))))
|
|
|
|
|
(dayname (substring time 0 3)))
|
|
|
|
|
(setq display-time-string
|
|
|
|
|
(mapconcat 'eval display-time-string-forms ""))
|
|
|
|
|
;; This is inside the let binding, but we are not going to document
|
|
|
|
|
;; what variables are available.
|
|
|
|
|
(run-hooks 'display-time-hook))
|
2013-11-29 18:00:57 +00:00
|
|
|
|
(force-mode-line-update 'all))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
|
|
|
|
(defun display-time-file-nonempty-p (file)
|
2010-10-02 13:21:43 +00:00
|
|
|
|
(let ((remote-file-name-inhibit-cache (- display-time-interval 5)))
|
|
|
|
|
(and (file-exists-p file)
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
|
(< 0 (file-attribute-size
|
|
|
|
|
(file-attributes (file-chase-links file)))))))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2000-09-29 03:26:00 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(define-minor-mode display-time-mode
|
|
|
|
|
"Toggle display of time, load level, and mail flag in mode lines.
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
|
|
|
|
|
When Display Time mode is enabled, it updates every minute (you
|
|
|
|
|
can control the number of seconds between updates by customizing
|
|
|
|
|
`display-time-interval'). If `display-time-day-and-date' is
|
|
|
|
|
non-nil, the current day and date are displayed as well. This
|
|
|
|
|
runs the normal hook `display-time-hook' after each update."
|
2000-11-03 22:36:12 +00:00
|
|
|
|
:global t :group 'display-time
|
2002-09-15 01:51:49 +00:00
|
|
|
|
(and display-time-timer (cancel-timer display-time-timer))
|
|
|
|
|
(setq display-time-timer nil)
|
|
|
|
|
(setq display-time-string "")
|
|
|
|
|
(or global-mode-string (setq global-mode-string '("")))
|
|
|
|
|
(setq display-time-load-average display-time-default-load-average)
|
|
|
|
|
(if display-time-mode
|
|
|
|
|
(progn
|
|
|
|
|
(or (memq 'display-time-string global-mode-string)
|
|
|
|
|
(setq global-mode-string
|
|
|
|
|
(append global-mode-string '(display-time-string))))
|
|
|
|
|
;; Set up the time timer.
|
|
|
|
|
(setq display-time-timer
|
|
|
|
|
(run-at-time t display-time-interval
|
|
|
|
|
'display-time-event-handler))
|
|
|
|
|
;; Make the time appear right away.
|
|
|
|
|
(display-time-update)
|
|
|
|
|
;; When you get new mail, clear "Mail" from the mode line.
|
|
|
|
|
(add-hook 'rmail-after-get-new-mail-hook
|
|
|
|
|
'display-time-event-handler))
|
|
|
|
|
(remove-hook 'rmail-after-get-new-mail-hook
|
|
|
|
|
'display-time-event-handler)))
|
2000-06-17 15:36:33 +00:00
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
|
|
|
|
|
;;; Obsolete names
|
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'display-time-world-list
|
|
|
|
|
'world-clock-list "28.1")
|
|
|
|
|
(define-obsolete-variable-alias 'display-time-world-time-format
|
|
|
|
|
'world-clock-time-format "28.1")
|
|
|
|
|
(define-obsolete-variable-alias 'display-time-world-buffer-name
|
|
|
|
|
'world-clock-buffer-name "28.1")
|
|
|
|
|
(define-obsolete-variable-alias 'display-time-world-timer-enable
|
|
|
|
|
'world-clock-timer-enable "28.1")
|
|
|
|
|
(define-obsolete-variable-alias 'display-time-world-timer-second
|
|
|
|
|
'world-clock-timer-second "28.1")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'display-time-world-mode
|
|
|
|
|
#'world-clock-mode "28.1")
|
|
|
|
|
(define-obsolete-function-alias 'display-time-world-display
|
|
|
|
|
#'world-clock-display "28.1")
|
|
|
|
|
(define-obsolete-function-alias 'display-time-world-timer
|
|
|
|
|
#'world-clock-update "28.1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; World clock
|
|
|
|
|
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
(defgroup world-clock nil
|
|
|
|
|
"Display a world clock."
|
|
|
|
|
:group 'display-time)
|
|
|
|
|
|
|
|
|
|
(defcustom zoneinfo-style-world-list
|
|
|
|
|
'(("America/Los_Angeles" "Seattle")
|
|
|
|
|
("America/New_York" "New York")
|
|
|
|
|
("Europe/London" "London")
|
|
|
|
|
("Europe/Paris" "Paris")
|
|
|
|
|
("Asia/Calcutta" "Bangalore")
|
|
|
|
|
("Asia/Tokyo" "Tokyo"))
|
|
|
|
|
"Alist of zoneinfo-style time zones and places for `world-clock'.
|
|
|
|
|
Each element has the form (TIMEZONE LABEL).
|
|
|
|
|
TIMEZONE should be a string of the form AREA/LOCATION, where AREA is
|
|
|
|
|
the name of a region -- a continent or ocean, and LOCATION is the name
|
|
|
|
|
of a specific location, e.g., a city, within that region.
|
2024-04-10 13:52:21 +00:00
|
|
|
|
LABEL is a string to display as the label of that TIMEZONE's time.
|
|
|
|
|
|
|
|
|
|
This option has effect only on systems that support Posix-style
|
|
|
|
|
zoneinfo files specified as CONTINENT/CITY. In particular,
|
|
|
|
|
MS-Windows doesn't support that; use `legacy-style-world-list' instead."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type '(repeat (list string string))
|
|
|
|
|
:version "23.1")
|
|
|
|
|
|
|
|
|
|
(defcustom legacy-style-world-list
|
|
|
|
|
'(("PST8PDT" "Seattle")
|
|
|
|
|
("EST5EDT" "New York")
|
|
|
|
|
("GMT0BST" "London")
|
|
|
|
|
("CET-1CDT" "Paris")
|
|
|
|
|
("IST-5:30" "Bangalore")
|
|
|
|
|
("JST-9" "Tokyo"))
|
|
|
|
|
"Alist of traditional-style time zones and places for `world-clock'.
|
|
|
|
|
Each element has the form (TIMEZONE LABEL).
|
|
|
|
|
TIMEZONE should be a string of the form:
|
|
|
|
|
|
|
|
|
|
std[+|-]offset[dst[offset][,date[/time],date[/time]]]
|
|
|
|
|
|
|
|
|
|
See the documentation of the TZ environment variable on your system,
|
|
|
|
|
for more details about the format of TIMEZONE.
|
2024-04-10 13:52:21 +00:00
|
|
|
|
LABEL is a string to display as the label of that TIMEZONE's time
|
|
|
|
|
|
|
|
|
|
This is the only option that has effect on MS-Windows, where you also
|
|
|
|
|
cannot specify the [offset][,date[/time],date[/time]] part."
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:type '(repeat (list string string))
|
|
|
|
|
:version "23.1")
|
|
|
|
|
|
|
|
|
|
(defcustom world-clock-list t
|
|
|
|
|
"Alist of time zones and places for `world-clock' to display.
|
|
|
|
|
Each element has the form (TIMEZONE LABEL).
|
|
|
|
|
TIMEZONE should be in a format supported by your system. See the
|
|
|
|
|
documentation of `zoneinfo-style-world-list' and
|
|
|
|
|
`legacy-style-world-list' for two widely used formats. LABEL is
|
|
|
|
|
a string to display as the label of that TIMEZONE's time.
|
|
|
|
|
|
|
|
|
|
If the value is t instead of an alist, use the value of
|
|
|
|
|
`zoneinfo-style-world-list' if it works on this platform, and of
|
|
|
|
|
`legacy-style-world-list' otherwise."
|
|
|
|
|
:type '(choice (const :tag "Default" t)
|
|
|
|
|
(repeat :tag "List of zones and labels"
|
|
|
|
|
(list (string :tag "Zone") (string :tag "Label"))))
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
|
|
(defun time--display-world-list ()
|
|
|
|
|
(if (listp world-clock-list)
|
|
|
|
|
world-clock-list
|
|
|
|
|
;; Determine if zoneinfo style timezones are supported by testing that
|
|
|
|
|
;; America/New York and Europe/London return different timezones.
|
|
|
|
|
(let ((nyt (format-time-string "%z" nil "America/New_York"))
|
|
|
|
|
(gmt (format-time-string "%z" nil "Europe/London")))
|
|
|
|
|
(if (string-equal nyt gmt)
|
|
|
|
|
legacy-style-world-list
|
|
|
|
|
zoneinfo-style-world-list))))
|
|
|
|
|
|
|
|
|
|
(defcustom world-clock-time-format "%A %d %B %R %Z"
|
|
|
|
|
"Time format for `world-clock', see `format-time-string'."
|
|
|
|
|
:type 'string
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
|
|
(defcustom world-clock-buffer-name "*wclock*"
|
|
|
|
|
"Name of the `world-clock' buffer."
|
|
|
|
|
:type 'string
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
|
|
(defcustom world-clock-timer-enable t
|
|
|
|
|
"If non-nil, a timer will update the `world-clock' buffer."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
|
|
(defcustom world-clock-timer-second 60
|
|
|
|
|
"Interval in seconds for updating the `world-clock' buffer."
|
Make some defcustom types more restrictive
* lisp/abbrev.el (abbrev-suggest-hint-threshold):
* lisp/bookmark.el (bookmark-bmenu-file-column)
(bookmark-menu-length):
* lisp/buff-menu.el (Buffer-menu-size-width)
(Buffer-menu-mode-width):
* lisp/calendar/calendar.el (calendar-week-start-day)
(calendar-intermonth-spacing, calendar-column-width)
(calendar-day-digit-width):
* lisp/calc/calc.el (calc-undo-length):
* lisp/calendar/timeclock.el (timeclock-workday):
* lisp/comint.el (comint-buffer-maximum-size)
(comint-input-ring-size):
* lisp/doc-view.el (doc-view-resolution, doc-view-image-width):
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-max-column):
* lisp/emacs-lisp/comp.el (native-comp-debug)
(native-comp-verbose, native-comp-async-jobs-number):
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width):
* lisp/eshell/esh-mode.el (eshell-buffer-maximum-lines):
* lisp/frame.el (blink-cursor-blinks):
* lisp/info.el (Info-breadcrumbs-depth):
* lisp/jit-lock.el (jit-lock-chunk-size):
* lisp/kmacro.el (kmacro-ring-max):
* lisp/menu-bar.el (yank-menu-length, yank-menu-max-items):
* lisp/midnight.el (clean-buffer-list-delay-general)
(clean-buffer-list-delay-special):
* lisp/net/dictionary.el (dictionary-port)
(dictionary-proxy-port):
* lisp/net/ldap.el (ldap-default-port):
* lisp/net/pop3.el (pop3-port, pop3-stream-length):
* lisp/net/rcirc.el (rcirc-default-port):
* lisp/net/sieve-manage.el (sieve-manage-default-port):
* lisp/play/spook.el (spook-phrase-default-count):
* lisp/play/tetris.el (tetris-buffer-width)
(tetris-buffer-height, tetris-width, tetris-height)
(tetris-top-left-x, tetris-top-left-y):
* lisp/profiler.el (profiler-sampling-interval):
* lisp/progmodes/sql.el (sql-port):
* lisp/recentf.el (recentf-max-menu-items):
* lisp/strokes.el (strokes-grid-resolution):
* lisp/tab-bar.el (tab-bar-tab-name-truncated-max):
* lisp/term/xterm.el (xterm-max-cut-length):
* lisp/time.el (display-time-interval, world-clock-timer-second):
* lisp/url/url-cache.el (url-cache-expire-time):
* lisp/url/url-cookie.el (url-cookie-save-interval):
* lisp/url/url-history.el (url-history-save-interval):
* lisp/url/url-queue.el (url-queue-parallel-processes)
(url-queue-timeout):
* lisp/url/url-vars.el (url-max-password-attempts)
(url-max-redirections):
* lisp/vc/emerge.el (emerge-min-visible-lines):
* lisp/vc/vc.el (vc-log-show-limit):
* lisp/window.el (window-min-height, window-min-width):
* lisp/winner.el (winner-ring-size): Use :type natnum.
* lisp/savehist.el (savehist-file-modes): Fix setting to nil value and
use :type natnum.
2022-07-05 14:26:45 +00:00
|
|
|
|
:type 'natnum
|
Rearrange and clean up code in time.el (Bug#40863)
* lisp/time.el (world-clock, zoneinfo-style-world-list)
(legacy-style-world-list, world-clock-list)
(time--display-world-list, world-clock-time-format)
(world-clock-timer-enable, world-clock-timer-second): Move definitions
closer to 'world-clock' code. Remove redundant :group args.
(display-time-mail-file, display-time-mail-directory)
(display-time-mail-function)
(display-time-default-load-average)
(display-time-load-average-threshold, display-time-day-and-date)
(display-time-interval, display-time-24hr-format)
(display-time-hook, display-time-mail-face)
(display-time-use-mail-icon, display-time-mail-string)
(display-time-format, display-time-string-forms): Remove redundant
:group args.
2020-08-09 21:42:06 +00:00
|
|
|
|
:version "28.1")
|
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(defface world-clock-label
|
2020-04-26 08:16:06 +00:00
|
|
|
|
'((t :inherit font-lock-variable-name-face))
|
2020-05-02 14:08:33 +00:00
|
|
|
|
"Face for time zone label in `world-clock' buffer.")
|
2020-04-26 08:16:06 +00:00
|
|
|
|
|
2021-12-10 02:11:49 +00:00
|
|
|
|
(defvar-keymap world-clock-mode-map
|
|
|
|
|
"n" #'next-line
|
2022-10-05 14:33:18 +00:00
|
|
|
|
"p" #'previous-line
|
|
|
|
|
"w" #'world-clock-copy-time-as-kill)
|
|
|
|
|
|
|
|
|
|
(defun world-clock-copy-time-as-kill ()
|
|
|
|
|
"Copy current line into the kill ring."
|
|
|
|
|
(interactive nil world-clock-mode)
|
|
|
|
|
(when-let ((str (buffer-substring-no-properties (pos-bol) (pos-eol))))
|
|
|
|
|
(kill-new str)
|
|
|
|
|
(message str)))
|
2021-04-22 18:27:18 +00:00
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(define-derived-mode world-clock-mode special-mode "World clock"
|
2007-08-28 15:06:43 +00:00
|
|
|
|
"Major mode for buffer that displays times in various time zones.
|
2020-05-02 14:08:33 +00:00
|
|
|
|
See `world-clock'."
|
2021-04-22 18:34:37 +00:00
|
|
|
|
:interactive nil
|
2020-08-19 18:31:29 +00:00
|
|
|
|
(setq-local revert-buffer-function #'world-clock-update)
|
2010-07-19 11:06:42 +00:00
|
|
|
|
(setq show-trailing-whitespace nil))
|
2007-08-28 15:06:43 +00:00
|
|
|
|
|
2020-10-24 13:47:26 +00:00
|
|
|
|
(defvar world-clock--timer nil
|
|
|
|
|
"The current world clock timer.")
|
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(defun world-clock-display (alist)
|
2007-08-28 15:06:43 +00:00
|
|
|
|
"Replace current buffer text with times in various zones, based on ALIST."
|
|
|
|
|
(let ((inhibit-read-only t)
|
2011-08-08 15:53:35 +00:00
|
|
|
|
(buffer-undo-list t)
|
New optional ZONE arg for format-time-string etc.
This simplifies time conversions in other time zones.
It also prevents display-time-world tampering with TZ (Bug#21020).
* admin/admin.el (add-release-logs):
Use improved add-log-time-format API.
* admin/merge-gnulib (GNULIB_MODULES): Add time_rz, timegm.
(GNULIB_TOOL_FLAGS): Avoid flexmember, setenv, unsetenv.
* configure.ac (tzalloc): Remove test for this, since
Emacs no longer uses HAVE_TZALLOC directly.
* doc/lispref/os.texi (Time of Day, Time Conversion)
(Time Parsing):
* etc/NEWS: Document the new behavior.
Merge from gnulib, incorporating:
2015-07-25 strftime: fix newly-introduced bug on Solaris
2015-07-23 fprintftime, strftime: use timezone_t args
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/strftime.c, lib/strftime.h, lib/time.in.h, m4/sys_time_h.m4:
* m4/time_h.m4:
Update from gnulib.
* lib/time_rz.c, lib/timegm.c, m4/time_rz.m4, m4/timegm.m4:
New files from gnulib.
* lisp/time-stamp.el (time-stamp-string):
* lisp/time.el (display-time-world-list)
(display-time-world-display):
Use new API, with time zone arg.
* lisp/time.el (display-time-world-display):
Fix race when current-time advances while we're running.
* lisp/vc/add-log.el (add-log-iso8601-time-zone)
(add-log-iso8601-time-string): Accept optional time zone arg.
* lisp/vc/add-log.el (add-change-log-entry):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p): Use new arg.
* nt/gnulib.mk: Propagate lib/gnulib.mk changes here.
Add rules for the time module, since they're now needed
for tzalloc etc.
* src/conf_post.h (getenv_TZ, setenv_TZ): New macros.
(emacs_getenv_TZ, emacs_setenv_TZ): New decls.
* src/editfns.c: Include errno.h.
(set_time_zone_rule): Omit unnecessary forward decl.
(initial_tz): Remove, replacing with ...
(local_tz, wall_clock_tz, utc_tz): New static vars and constants.
(tzeqlen): New constant; prefer it to (sizeof "TZ=" - 1).
(emacs_localtime_rz, emacs_mktime_z, xtzalloc, xtzfree)
(tzlookup): New static functions.
(init_editfns): New arg DUMPING. All uses changed.
(init_editfns): Omit most initialization if dumping, not if
!initialized. Initialize wall_clock_tz and local_tz.
(emacs_nmemftime, format_time_string): Time zone argument can now
be any time zone, not just a boolean for UTC or local time. All
callers changed.
(Fformat_time_string, Fencode_time, Fcurrent_time_string)
(Fcurrent_time_zone): New optional arg ZONE.
(Fdecode_time, Fset_time_zone_rule): ZONE arg can now also take
the same form as with the other new additions.
(decode_time_zone): Remove; no longer needed.
(tzvalbuf): Now file-scope.
(emacs_getenv_TZ, emacs_setenv_TZ): New functions.
(syms_of_editfns): Define Qwall.
* src/editfns.c (mktime_z) [!HAVE_TZALLOC]:
* src/systime.h (mktime_z, timezone_t, tzalloc, tzfree)
[!HAVE_TZALLOC]:
Remove; now supplied by gnulib.
* src/emacs.c (main):
* src/lisp.h (init_editfns): Adjust to init_editfns API change.
2015-07-26 07:01:34 +00:00
|
|
|
|
(now (current-time))
|
2011-08-08 15:53:35 +00:00
|
|
|
|
(max-width 0)
|
|
|
|
|
result fmt)
|
2007-08-28 15:06:43 +00:00
|
|
|
|
(erase-buffer)
|
New optional ZONE arg for format-time-string etc.
This simplifies time conversions in other time zones.
It also prevents display-time-world tampering with TZ (Bug#21020).
* admin/admin.el (add-release-logs):
Use improved add-log-time-format API.
* admin/merge-gnulib (GNULIB_MODULES): Add time_rz, timegm.
(GNULIB_TOOL_FLAGS): Avoid flexmember, setenv, unsetenv.
* configure.ac (tzalloc): Remove test for this, since
Emacs no longer uses HAVE_TZALLOC directly.
* doc/lispref/os.texi (Time of Day, Time Conversion)
(Time Parsing):
* etc/NEWS: Document the new behavior.
Merge from gnulib, incorporating:
2015-07-25 strftime: fix newly-introduced bug on Solaris
2015-07-23 fprintftime, strftime: use timezone_t args
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/strftime.c, lib/strftime.h, lib/time.in.h, m4/sys_time_h.m4:
* m4/time_h.m4:
Update from gnulib.
* lib/time_rz.c, lib/timegm.c, m4/time_rz.m4, m4/timegm.m4:
New files from gnulib.
* lisp/time-stamp.el (time-stamp-string):
* lisp/time.el (display-time-world-list)
(display-time-world-display):
Use new API, with time zone arg.
* lisp/time.el (display-time-world-display):
Fix race when current-time advances while we're running.
* lisp/vc/add-log.el (add-log-iso8601-time-zone)
(add-log-iso8601-time-string): Accept optional time zone arg.
* lisp/vc/add-log.el (add-change-log-entry):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p): Use new arg.
* nt/gnulib.mk: Propagate lib/gnulib.mk changes here.
Add rules for the time module, since they're now needed
for tzalloc etc.
* src/conf_post.h (getenv_TZ, setenv_TZ): New macros.
(emacs_getenv_TZ, emacs_setenv_TZ): New decls.
* src/editfns.c: Include errno.h.
(set_time_zone_rule): Omit unnecessary forward decl.
(initial_tz): Remove, replacing with ...
(local_tz, wall_clock_tz, utc_tz): New static vars and constants.
(tzeqlen): New constant; prefer it to (sizeof "TZ=" - 1).
(emacs_localtime_rz, emacs_mktime_z, xtzalloc, xtzfree)
(tzlookup): New static functions.
(init_editfns): New arg DUMPING. All uses changed.
(init_editfns): Omit most initialization if dumping, not if
!initialized. Initialize wall_clock_tz and local_tz.
(emacs_nmemftime, format_time_string): Time zone argument can now
be any time zone, not just a boolean for UTC or local time. All
callers changed.
(Fformat_time_string, Fencode_time, Fcurrent_time_string)
(Fcurrent_time_zone): New optional arg ZONE.
(Fdecode_time, Fset_time_zone_rule): ZONE arg can now also take
the same form as with the other new additions.
(decode_time_zone): Remove; no longer needed.
(tzvalbuf): Now file-scope.
(emacs_getenv_TZ, emacs_setenv_TZ): New functions.
(syms_of_editfns): Define Qwall.
* src/editfns.c (mktime_z) [!HAVE_TZALLOC]:
* src/systime.h (mktime_z, timezone_t, tzalloc, tzfree)
[!HAVE_TZALLOC]:
Remove; now supplied by gnulib.
* src/emacs.c (main):
* src/lisp.h (init_editfns): Adjust to init_editfns API change.
2015-07-26 07:01:34 +00:00
|
|
|
|
(dolist (zone alist)
|
|
|
|
|
(let* ((label (cadr zone))
|
|
|
|
|
(width (string-width label)))
|
|
|
|
|
(push (cons label
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(format-time-string world-clock-time-format
|
New optional ZONE arg for format-time-string etc.
This simplifies time conversions in other time zones.
It also prevents display-time-world tampering with TZ (Bug#21020).
* admin/admin.el (add-release-logs):
Use improved add-log-time-format API.
* admin/merge-gnulib (GNULIB_MODULES): Add time_rz, timegm.
(GNULIB_TOOL_FLAGS): Avoid flexmember, setenv, unsetenv.
* configure.ac (tzalloc): Remove test for this, since
Emacs no longer uses HAVE_TZALLOC directly.
* doc/lispref/os.texi (Time of Day, Time Conversion)
(Time Parsing):
* etc/NEWS: Document the new behavior.
Merge from gnulib, incorporating:
2015-07-25 strftime: fix newly-introduced bug on Solaris
2015-07-23 fprintftime, strftime: use timezone_t args
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/strftime.c, lib/strftime.h, lib/time.in.h, m4/sys_time_h.m4:
* m4/time_h.m4:
Update from gnulib.
* lib/time_rz.c, lib/timegm.c, m4/time_rz.m4, m4/timegm.m4:
New files from gnulib.
* lisp/time-stamp.el (time-stamp-string):
* lisp/time.el (display-time-world-list)
(display-time-world-display):
Use new API, with time zone arg.
* lisp/time.el (display-time-world-display):
Fix race when current-time advances while we're running.
* lisp/vc/add-log.el (add-log-iso8601-time-zone)
(add-log-iso8601-time-string): Accept optional time zone arg.
* lisp/vc/add-log.el (add-change-log-entry):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p): Use new arg.
* nt/gnulib.mk: Propagate lib/gnulib.mk changes here.
Add rules for the time module, since they're now needed
for tzalloc etc.
* src/conf_post.h (getenv_TZ, setenv_TZ): New macros.
(emacs_getenv_TZ, emacs_setenv_TZ): New decls.
* src/editfns.c: Include errno.h.
(set_time_zone_rule): Omit unnecessary forward decl.
(initial_tz): Remove, replacing with ...
(local_tz, wall_clock_tz, utc_tz): New static vars and constants.
(tzeqlen): New constant; prefer it to (sizeof "TZ=" - 1).
(emacs_localtime_rz, emacs_mktime_z, xtzalloc, xtzfree)
(tzlookup): New static functions.
(init_editfns): New arg DUMPING. All uses changed.
(init_editfns): Omit most initialization if dumping, not if
!initialized. Initialize wall_clock_tz and local_tz.
(emacs_nmemftime, format_time_string): Time zone argument can now
be any time zone, not just a boolean for UTC or local time. All
callers changed.
(Fformat_time_string, Fencode_time, Fcurrent_time_string)
(Fcurrent_time_zone): New optional arg ZONE.
(Fdecode_time, Fset_time_zone_rule): ZONE arg can now also take
the same form as with the other new additions.
(decode_time_zone): Remove; no longer needed.
(tzvalbuf): Now file-scope.
(emacs_getenv_TZ, emacs_setenv_TZ): New functions.
(syms_of_editfns): Define Qwall.
* src/editfns.c (mktime_z) [!HAVE_TZALLOC]:
* src/systime.h (mktime_z, timezone_t, tzalloc, tzfree)
[!HAVE_TZALLOC]:
Remove; now supplied by gnulib.
* src/emacs.c (main):
* src/lisp.h (init_editfns): Adjust to init_editfns API change.
2015-07-26 07:01:34 +00:00
|
|
|
|
now (car zone)))
|
|
|
|
|
result)
|
|
|
|
|
(when (> width max-width)
|
|
|
|
|
(setq max-width width))))
|
2011-08-08 15:53:35 +00:00
|
|
|
|
(setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
|
|
|
|
|
(dolist (timedata (nreverse result))
|
2020-04-26 08:16:06 +00:00
|
|
|
|
(insert (format fmt
|
|
|
|
|
(propertize (car timedata)
|
2020-05-02 14:08:33 +00:00
|
|
|
|
'face 'world-clock-label)
|
2020-04-26 08:16:06 +00:00
|
|
|
|
(cdr timedata))))
|
2016-05-19 23:01:08 +00:00
|
|
|
|
(delete-char -1))
|
|
|
|
|
(goto-char (point-min)))
|
2007-08-28 15:06:43 +00:00
|
|
|
|
|
2020-08-19 18:31:29 +00:00
|
|
|
|
;;;###autoload
|
2020-09-13 13:09:20 +00:00
|
|
|
|
(define-obsolete-function-alias 'display-time-world
|
|
|
|
|
#'world-clock "28.1")
|
2020-08-19 18:31:29 +00:00
|
|
|
|
|
2007-08-28 15:06:43 +00:00
|
|
|
|
;;;###autoload
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(defun world-clock ()
|
|
|
|
|
"Display a world clock buffer with times in various time zones.
|
|
|
|
|
The variable `world-clock-list' specifies which time zones to use.
|
2024-01-21 13:09:21 +00:00
|
|
|
|
To turn off the world time display, go to the window and type \\[quit-window]."
|
2007-08-28 15:06:43 +00:00
|
|
|
|
(interactive)
|
2020-09-03 15:19:15 +00:00
|
|
|
|
(if-let ((buffer (get-buffer world-clock-buffer-name)))
|
|
|
|
|
(pop-to-buffer buffer)
|
|
|
|
|
(pop-to-buffer world-clock-buffer-name)
|
|
|
|
|
(when world-clock-timer-enable
|
2020-10-24 13:47:26 +00:00
|
|
|
|
(setq world-clock--timer
|
|
|
|
|
(run-at-time t world-clock-timer-second #'world-clock-update))
|
2020-09-03 15:19:15 +00:00
|
|
|
|
(add-hook 'kill-buffer-hook #'world-clock-cancel-timer nil t)))
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(world-clock-display (time--display-world-list))
|
|
|
|
|
(world-clock-mode)
|
2020-04-26 08:16:06 +00:00
|
|
|
|
(fit-window-to-buffer))
|
2007-08-28 15:06:43 +00:00
|
|
|
|
|
2020-09-03 10:54:30 +00:00
|
|
|
|
(defun world-clock-cancel-timer ()
|
|
|
|
|
"Cancel the world clock timer."
|
2020-10-24 13:47:26 +00:00
|
|
|
|
(when world-clock--timer
|
|
|
|
|
(cancel-timer world-clock--timer)
|
2020-10-24 14:50:16 +00:00
|
|
|
|
(setq world-clock--timer nil)))
|
2020-09-03 10:54:30 +00:00
|
|
|
|
|
2020-05-02 14:08:33 +00:00
|
|
|
|
(defun world-clock-update (&optional _arg _noconfirm)
|
|
|
|
|
"Update the `world-clock' buffer."
|
|
|
|
|
(if (get-buffer world-clock-buffer-name)
|
2024-03-12 00:21:06 +00:00
|
|
|
|
(with-current-buffer world-clock-buffer-name
|
2021-04-22 18:27:18 +00:00
|
|
|
|
(let ((op (point)))
|
|
|
|
|
(world-clock-display (time--display-world-list))
|
|
|
|
|
(goto-char op)))
|
2020-09-03 15:19:15 +00:00
|
|
|
|
(world-clock-cancel-timer)))
|
2007-08-28 15:06:43 +00:00
|
|
|
|
|
2008-02-16 03:29:43 +00:00
|
|
|
|
;;;###autoload
|
2020-09-18 14:22:55 +00:00
|
|
|
|
(defun emacs-uptime (&optional format here)
|
2008-02-16 03:31:19 +00:00
|
|
|
|
"Return a string giving the uptime of this instance of Emacs.
|
|
|
|
|
FORMAT is a string to format the result, using `format-seconds'.
|
2020-09-18 14:22:55 +00:00
|
|
|
|
For example, the Unix uptime command format is \"%D, %z%2h:%.2m\".
|
|
|
|
|
If the optional argument HERE is non-nil, insert string at
|
|
|
|
|
point."
|
|
|
|
|
(interactive "i\nP")
|
2008-02-16 03:29:43 +00:00
|
|
|
|
(let ((str
|
2008-02-16 03:31:19 +00:00
|
|
|
|
(format-seconds (or format "%Y, %D, %H, %M, %z%S")
|
New function time-convert
This replaces the awkward reuse of encode-time to both convert
calendrical timestamps to Lisp timestamps, and to convert Lisp
timestamps to other forms. Now, encode-time does just the
former and the new function does just the latter.
The new function builds on a suggestion by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00801.html
and refined by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00803.html
* doc/lispref/os.texi (Time of Day, Time Conversion):
* doc/misc/emacs-mime.texi (time-date):
* etc/NEWS: Update documentation.
* lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
* lisp/calendar/time-date.el (seconds-to-time, days-to-time):
* lisp/calendar/timeclock.el (timeclock-seconds-to-time):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-add-item):
* lisp/emacs-lisp/cl-extra.el (cl--random-time):
* lisp/emacs-lisp/timer.el (timer--time-setter)
(timer-next-integral-multiple-of-time):
* lisp/find-lisp.el (find-lisp-format-time):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/gnus-group.el (gnus-group-set-timestamp):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda):
* lisp/gnus/nnrss.el (nnrss-normalize-date):
* lisp/gnus/nnspool.el (nnspool-request-newgroups):
* lisp/net/ntlm.el (ntlm-compute-timestamp):
* lisp/net/pop3.el (pop3-uidl-dele):
* lisp/obsolete/vc-arch.el (vc-arch-add-tagline):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-clock-in)
(org-clock-out, org-clock-sum):
* lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/flymake.el (flymake--schedule-timer-maybe):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
* lisp/tar-mode.el (tar-octal-time):
* lisp/time.el (emacs-uptime):
* lisp/url/url-auth.el (url-digest-auth-make-cnonce):
* lisp/url/url-util.el (url-lazy-message):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg-state-fast):
* lisp/xt-mouse.el (xterm-mouse-event):
* test/lisp/emacs-lisp/timer-tests.el:
(timer-next-integral-multiple-of-time-2):
Use time-convert, not encode-time.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Don’t use now-removed FORM argument for encode-time.
It wasn’t crucial anyway.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert.
* lisp/emacs-lisp/elint.el (elint-unknown-builtin-args):
Update encode-time signature to match current arg set.
* lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time):
Use timer-convert with t rather than doing it by hand.
* src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp):
Remove; no longer needed.
(decode_lisp_time): Rturn the form instead of having a *PFORM arg.
All uses changed.
(time_arith): Just return TICKS if HZ is 1.
(Fencode_time): Remove argument FORM. All callers changed.
Do not attempt to encode time values; just encode
decoded (calendrical) times.
Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1.
(Ftime_convert): New function, which does the time value
conversion that bleeding-edge encode-time formerly did.
Return TIME if it is easy to see that it is already
of the correct form.
(Fcurrent_time): Mention in doc that the form is planned to change.
* test/src/timefns-tests.el (decode-then-encode-time):
Don’t use (encode-time nil).
2019-08-06 00:38:52 +00:00
|
|
|
|
(time-convert
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-23 02:32:31 +00:00
|
|
|
|
(time-since before-init-time)
|
|
|
|
|
'integer))))
|
2020-09-18 14:22:55 +00:00
|
|
|
|
(if here
|
|
|
|
|
(insert str)
|
|
|
|
|
(if (called-interactively-p 'interactive)
|
|
|
|
|
(message "%s" str)
|
|
|
|
|
str))))
|
2008-02-16 03:29:43 +00:00
|
|
|
|
|
2008-02-16 23:18:14 +00:00
|
|
|
|
;;;###autoload
|
2021-03-24 09:34:22 +00:00
|
|
|
|
(defun emacs-init-time (&optional format)
|
|
|
|
|
"Return a string giving the duration of the Emacs initialization.
|
2021-09-14 06:43:18 +00:00
|
|
|
|
FORMAT is a string to format the result, using `format'. If nil,
|
2021-03-24 09:34:22 +00:00
|
|
|
|
the default format \"%f seconds\" is used."
|
2008-02-16 23:18:14 +00:00
|
|
|
|
(interactive)
|
2021-03-24 09:34:22 +00:00
|
|
|
|
(let ((str (format (or format "%f seconds")
|
|
|
|
|
(float-time (time-subtract after-init-time
|
|
|
|
|
before-init-time)))))
|
2009-10-02 03:48:36 +00:00
|
|
|
|
(if (called-interactively-p 'interactive)
|
2008-02-16 23:18:14 +00:00
|
|
|
|
(message "%s" str)
|
|
|
|
|
str)))
|
|
|
|
|
|
2000-06-17 15:36:33 +00:00
|
|
|
|
(provide 'time)
|
|
|
|
|
|
|
|
|
|
;;; time.el ends here
|