commit 2860f6cec56b02120b0b62cb3733c00a9e5359db (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Feb 11 00:08:03 2019 -0800 Simplify url-digest-auth-make-cnonce * lisp/url/url-auth.el (url-digest-auth-make-cnonce): Simplify by using encode-time instead of round-tripping through a format-time-string and ‘read’. diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el index 1ef73a62c0..0746cfd96c 100644 --- a/lisp/url/url-auth.el +++ b/lisp/url/url-auth.el @@ -192,8 +192,7 @@ key cache `url-digest-auth-storage'." (defun url-digest-auth-make-cnonce () "Compute a new unique client nonce value." (base64-encode-string - (apply #'format "%016x%08x%08x" (random) - (read (format-time-string "(%s %N)"))) + (format "%016x%016x" (random) (car (encode-time nil t))) t)) (defun url-digest-auth-nonce-count (_nonce) commit 93241242537ad18b08486d4abd00e16c225a6a30 Author: Paul Eggert Date: Sun Feb 10 23:46:24 2019 -0800 Don’t assume CURRENT_TIME_LIST Use timestamp accessors instead of delving into a timestamp format that is planned to change in a future version. * lisp/find-lisp.el (find-lisp-format-time): * lisp/gnus/gnus-group.el (gnus-group-set-timestamp): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda): Use encode-time instead of delving into timestamp format. * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): Use float-time instead of delving into timestamp format. * lisp/gnus/nnmaildir.el (nnmaildir-request-accept-article): Use format-time-string instead of delving into timestamp format. * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): Use time-less-p instead of delving into timestamp format. * lisp/ido.el (ido-wash-history, ido-file-name-all-completions): Use time-equal-p instead of delving into timestamp format. * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): Use format-time-string to generate POSIX ‘test -t’ format instead of timestamp-format-dependent code along with shell arithmetic that can’t possibly do the right thing on a POSIX platform. diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el index c5febee6f5..073e2bc573 100644 --- a/lisp/find-lisp.el +++ b/lisp/find-lisp.el @@ -342,16 +342,11 @@ list of ls option letters of which c and u are recognized). Use the same method as \"ls\" to decide whether to show time-of-day or year, depending on distance between file date and NOW." (let* ((time (nth (find-lisp-time-index switches) file-attr)) - (diff16 (- (car time) (car now))) - (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now))))) - (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months + (diff (encode-time (time-subtract time now) 'integer)) + (past-cutoff -15778476) ; 1/2 of a Gregorian year (future-cutoff (* 60 60))) ; 1 hour (format-time-string - (if (and - (<= past-cutoff diff) (<= diff future-cutoff) - ;; Sanity check in case `diff' computation overflowed. - (<= (1- (ash past-cutoff -16)) diff16) - (<= diff16 (1+ (ash future-cutoff -16)))) + (if (<= past-cutoff diff future-cutoff) "%b %e %H:%M" "%b %e %Y") time))) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 510bd7415d..cf8423b2db 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -4578,8 +4578,7 @@ and the second element is the address." This function can be used in hooks like `gnus-select-group-hook' or `gnus-group-catchup-group-hook'." (when gnus-newsgroup-name - (let ((time (current-time))) - (setcdr (cdr time) nil) + (let ((time (encode-time nil 'integer))) (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time)))) (defsubst gnus-group-timestamp (group) @@ -4588,11 +4587,11 @@ or `gnus-group-catchup-group-hook'." (defun gnus-group-timestamp-delta (group) "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number." - (let* ((time (or (gnus-group-timestamp group) - (list 0 0))) + ;; FIXME: This should return a Lisp integer, not a Lisp float, + ;; since it is always an integer. + (let* ((time (or (gnus-group-timestamp group) 0)) (delta (time-subtract nil time))) - (+ (* (nth 0 delta) 65536.0) - (nth 1 delta)))) + (float-time delta))) (defun gnus-group-timestamp-string (group) "Return a string of the timestamp for GROUP." diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 06f0927164..a9d15f9226 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -655,10 +655,7 @@ is searched." (defun gnus-icalendar-show-org-agenda (event) (let* ((time-delta (time-subtract (gnus-icalendar-event:end-time event) (gnus-icalendar-event:start-time event))) - (duration-days (1+ (/ (+ (* (car time-delta) (expt 2 16)) - (cadr time-delta)) - 86400)))) - + (duration-days (1+ (floor (encode-time time-delta 'integer) 86400)))) (org-agenda-list nil (gnus-icalendar-event:start event) duration-days))) (cl-defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-request) reply-status) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index afaf3dcfcf..9df2292e78 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -1467,7 +1467,7 @@ This variable is set by `nnmaildir-request-article'.") (unless (string-equal nnmaildir--delivery-time file) (setq nnmaildir--delivery-time file nnmaildir--delivery-count 0)) - (setq file (concat file "M" (number-to-string (caddr time)))) + (setq file (concat file (format-time-string "M%6N" time))) (setq file (concat file nnmaildir--delivery-pid) file (concat file "Q" (number-to-string nnmaildir--delivery-count)) file (concat file "." (nnmaildir--system-name)) @@ -1553,7 +1553,7 @@ This variable is set by `nnmaildir-request-article'.") (defun nnmaildir-request-expire-articles (ranges &optional gname server force) (let ((no-force (not force)) (group (nnmaildir--prepare server gname)) - pgname time boundary bound-iter high low target dir nlist + pgname time boundary high low target dir nlist didnt nnmaildir--file nnmaildir-article-file-name deactivate-mark) (catch 'return @@ -1602,15 +1602,8 @@ This variable is set by `nnmaildir-request-article'.") ((null time) (nnmaildir--expired-article group article)) ((and no-force - (progn - (setq time (file-attribute-modification-time time) - bound-iter boundary) - (while (and bound-iter time - (= (car bound-iter) (car time))) - (setq bound-iter (cdr bound-iter) - time (cdr time))) - (and bound-iter time - (car-less-than-car bound-iter time)))) + (time-less-p boundary + (file-attribute-modification-time time))) (setq didnt (cons (nnmaildir--art-num article) didnt))) (t (setq nnmaildir-article-file-name nnmaildir--file diff --git a/lisp/ido.el b/lisp/ido.el index b32cacce75..8078d184db 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1515,20 +1515,20 @@ Removes badly formatted data and ignored directories." (files (cdr (cdr (car l))))) (and (stringp dir) - (consp time) - (cond - ((integerp (car time)) - (and (not (zerop (float-time time))) - (ido-may-cache-directory dir))) - ((eq (car time) 'ftp) - (and (numberp (cdr time)) - (ido-is-ftp-directory dir) - (ido-cache-ftp-valid (cdr time)))) - ((eq (car time) 'unc) - (and (numberp (cdr time)) - (ido-is-unc-host dir) - (ido-cache-unc-valid (cdr time)))) - (t nil)) + (if (condition-case nil + (not (time-equal-p time 0)) + (error)) + (ido-may-cache-directory dir) + (and + (consp time) + (numberp (cdr time)) + (cond + ((eq (car time) 'ftp) + (and (ido-is-ftp-directory dir) + (ido-cache-ftp-valid (cdr time)))) + ((eq (car time) 'unc) + (and (ido-is-unc-host dir) + (ido-cache-unc-valid (cdr time))))))) (let ((s files) (ok t)) (while s (if (stringp (car s)) @@ -3621,8 +3621,7 @@ Uses and updates `ido-dir-file-cache'." (ido-cache-unc-valid (cdr ctime))))) (t (if attr - (setq valid (and (= (car ctime) (car mtime)) - (= (car (cdr ctime)) (car (cdr mtime)))))))) + (setq valid (time-equal-p ctime mtime))))) (unless valid (setq ido-dir-file-cache (delq cached ido-dir-file-cache) cached nil))) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 34faf4ce28..f8b0505b41 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -679,9 +679,8 @@ But handle the case, if the \"test\" command is not available." (current-time) time))) (tramp-adb-send-command-and-check - ;; Use shell arithmetic because of Emacs integer size limit. - v (format "touch -t $(( %d * 65536 + %d )) %s" - (car time) (cadr time) + v (format "touch -t %s %s" + (format-time-string "%Y%m%d%H%M.%S" time) (tramp-shell-quote-argument localname)))))) (defun tramp-adb-handle-copy-file diff --git a/lisp/woman.el b/lisp/woman.el index 9548fdc6b3..110069335c 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -2010,10 +2010,8 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated." ;; (after Man-bgproc-sentinel-advice activate) ;; ;; Terminates man processing ;; "Report formatting time." -;; (let* ((time (current-time)) -;; (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536) -;; (- (cadr time) (cadr WoMan-Man-start-time))))) -;; (message "Man formatting done in %d seconds" time))) +;; (message "Man formatting done in %s seconds" +;; (float-time (time-subtract nil WoMan-Man-start-time)))) ;;; Buffer handling: commit 988e37fa0f922b852715671d59a0e3f682373411 Author: Paul Eggert Date: Sun Feb 10 20:25:22 2019 -0800 Simplify use of encode-time Most uses of (apply #'encode-time foo) can now be replaced with (encode-time foo). Make similar simplifications. * lisp/calendar/time-date.el (date-to-time): * lisp/calendar/timeclock.el (timeclock-when-to-leave) (timeclock-day-base, timeclock-generate-report): * lisp/emacs-lisp/timer.el (timer-set-idle-time): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/gnus/gnus-art.el (article-make-date-line): * lisp/gnus/gnus-delay.el (gnus-delay-article) (gnus-delay-send-queue): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--decode-datefield): * lisp/gnus/gnus-logic.el (gnus-advanced-date): * lisp/gnus/message.el (message-make-expires-date): * lisp/gnus/nndiary.el (nndiary-compute-reminders): * lisp/mail/ietf-drums.el (ietf-drums-parse-date): * lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p): * lisp/org/org-agenda.el (org-agenda-get-timestamps) (org-agenda-get-progress, org-agenda-show-clocking-issues): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-get-sum-start, org-clock-sum) (org-clocktable-steps): * lisp/org/org-colview.el (org-colview-construct-allowed-dates) * lisp/org/org-macro.el (org-macro--vc-modified-time): * lisp/org/org-table.el (org-table-eval-formula): * lisp/org/org.el (org-current-time, org-store-link) (org-time-today, org-read-date, org-read-date-display) (org-display-custom-time, org-time-string-to-time) (org-timestamp-change, org-timestamp--to-internal-time): * lisp/url/url-dav.el (url-dav-process-date-property): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time) (vc-cvs-parse-entry): Simplify use of encode-time. * lisp/org/org-clock.el (org-clock-get-clocked-time): (org-clock-resolve, org-resolve-clocks, org_clock_out) (org-clock-update-time-maybe): Avoid some rounding problems with encode-time and float-time. * lisp/org/org-clock.el (org-clock-in, org-clock-update-time-maybe): * lisp/org/org-colview.el (org-columns--age-to-minutes): * lisp/org/org.el (org-get-scheduled-time, org-get-deadline-time) (org-add-planning-info, org-2ft, org-time-string-to-absolute) (org-closest-date): Use org-time-string-to-time instead of doing it by hand with encode-time. * lisp/org/org.el (org-current-time): Simplify rounding. (org-read-date): Avoid extra trip through encode-time. diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 6fb0f22427..cc30bd1fda 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -151,15 +151,14 @@ it is assumed that PICO was omitted and should be treated as zero." DATE should be in one of the forms recognized by `parse-time-string'. If DATE lacks timezone information, GMT is assumed." (condition-case err - (apply 'encode-time (parse-time-string date)) + (encode-time (parse-time-string date)) (error (let ((overflow-error '(error "Specified time is not representable"))) (if (equal err overflow-error) (apply 'signal err) (condition-case err - (apply 'encode-time - (parse-time-string - (timezone-make-date-arpa-standard date))) + (encode-time (parse-time-string + (timezone-make-date-arpa-standard date))) (error (if (equal err overflow-error) (apply 'signal err) diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index fd6f5310c8..5c3580dd84 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -528,14 +528,13 @@ non-nil, the amount returned will be relative to past time worked." "Return a time value representing the end of today's workday. If TODAY-ONLY is non-nil, the value returned will be relative only to the time worked today, and not to past time." - (encode-time - (- (float-time) - (let ((discrep (timeclock-find-discrep))) - (if discrep - (if today-only - (cadr discrep) - (car discrep)) - 0.0))))) + (time-subtract nil + (let ((discrep (timeclock-find-discrep))) + (if discrep + (if today-only + (cadr discrep) + (car discrep)) + 0)))) ;;;###autoload (defun timeclock-when-to-leave-string (&optional show-seconds @@ -1156,7 +1155,7 @@ If optional argument TIME is non-nil, use that instead of the current time." (setcar (nthcdr 0 decoded) 0) (setcar (nthcdr 1 decoded) 0) (setcar (nthcdr 2 decoded) 0) - (apply 'encode-time decoded))) + (encode-time decoded))) (defun timeclock-mean (l) "Compute the arithmetic mean of the values in the list L." @@ -1196,9 +1195,7 @@ HTML-P is non-nil, HTML markup is added." (insert project "
\n") (insert project "*\n")) (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) - (two-weeks-ago (encode-time - (- (float-time today) - (* 2 7 24 60 60)))) + (two-weeks-ago (time-subtract today (* 2 7 24 60 60))) two-week-len today-len) (while proj-data (if (not (time-less-p @@ -1249,18 +1246,10 @@ HTML-P is non-nil, HTML markup is added." -1 year ") (let* ((day-list (timeclock-day-list)) - (thirty-days-ago (encode-time - (- (float-time today) - (* 30 24 60 60)))) - (three-months-ago (encode-time - (- (float-time today) - (* 90 24 60 60)))) - (six-months-ago (encode-time - (- (float-time today) - (* 180 24 60 60)))) - (one-year-ago (encode-time - (- (float-time today) - (* 365 24 60 60)))) + (thirty-days-ago (time-subtract today (* 30 24 60 60))) + (three-months-ago (time-subtract today (* 90 24 60 60))) + (six-months-ago (time-subtract today (* 180 24 60 60))) + (one-year-ago (time-subtract today (* 365 24 60 60))) (time-in (vector (list t) (list t) (list t) (list t) (list t))) (time-out (vector (list t) (list t) (list t) (list t) (list t))) (breaks (vector (list t) (list t) (list t) (list t) (list t))) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index f77c945786..51d7e6f99e 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -88,7 +88,7 @@ SECS may be an integer, floating point number, or the internal time format returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." - (setf (timer--time timer) (if (consp secs) secs (encode-time secs))) + (setf (timer--time timer) secs) (setf (timer--repeat-delay timer) repeat) timer) diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 7e6e39e74a..118978e77d 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -652,7 +652,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (setcar (nthcdr 0 moment) 0) (setcar (nthcdr 1 moment) 0) (setcar (nthcdr 2 moment) 0)) - (apply 'encode-time moment)) + (encode-time moment)) (ange-ftp-file-modtime (expand-file-name name dir)))) symlink) (if (string-match "\\(.+\\) -> \\(.+\\)" name) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e39011837a..191f623afa 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -3544,7 +3544,7 @@ possible values." (substring (message-make-date (let* ((e (parse-time-string date)) - (tm (apply 'encode-time e)) + (tm (encode-time e)) (ms (car tm)) (ls (- (cadr tm) (car (current-time-zone time))))) (cond ((< ls 0) (list (1- ms) (+ ls 65536))) diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el index e013f26adf..aabf23924a 100644 --- a/lisp/gnus/gnus-delay.el +++ b/lisp/gnus/gnus-delay.el @@ -98,19 +98,15 @@ DELAY is a string, giving the length of the time. Possible values are: (setq hour (string-to-number (match-string 1 delay)) minute (string-to-number (match-string 2 delay))) ;; Use current time, except... - (setq deadline (apply 'vector (decode-time))) + (setq deadline (decode-time)) ;; ... for minute and hour. - (aset deadline 1 minute) - (aset deadline 2 hour) - ;; Convert to seconds. - (setq deadline (float-time (apply 'encode-time - (append deadline nil)))) + (setq deadline (apply #'encode-time (car deadline) minute hour + (nthcdr 3 deadline))) ;; If this time has passed already, add a day. - (when (< deadline (float-time)) - (setq deadline (+ 86400 deadline))) ; 86400 secs/day + (when (time-less-p deadline nil) + (setq deadline (time-add 86400 deadline))) ; 86400 secs/day ;; Convert seconds to date header. - (setq deadline (message-make-date - (encode-time deadline)))) + (setq deadline (message-make-date deadline))) ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay) (setq num (match-string 1 delay)) (setq unit (match-string 2 delay)) @@ -128,8 +124,7 @@ DELAY is a string, giving the length of the time. Possible values are: (setq delay (* num 60 60))) (t (setq delay (* num 60)))) - (setq deadline (message-make-date - (encode-time (+ (float-time) delay))))) + (setq deadline (message-make-date (time-add nil delay)))) (t (error "Malformed delay `%s'" delay))) (message-add-header (format "%s: %s" gnus-delay-header deadline))) (set-buffer-modified-p t) @@ -164,8 +159,7 @@ DELAY is a string, giving the length of the time. Possible values are: nil t) (progn (setq deadline (nnheader-header-value)) - (setq deadline (apply 'encode-time - (parse-time-string deadline))) + (setq deadline (encode-time (parse-time-string deadline))) (unless (time-less-p nil deadline) (message "Sending delayed article %d" article) (gnus-draft-send article group) diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index e39561edb3..06f0927164 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -147,7 +147,7 @@ (icalendar--get-event-property-attributes event field) zone-map)) (dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone))) - (apply 'encode-time dtdate-dec))) + (encode-time dtdate-dec))) (defun gnus-icalendar-event--find-attendee (ical name-or-email) (let* ((event (car (icalendar--all-events ical))) diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el index 8bf15cfd5b..90f7420520 100644 --- a/lisp/gnus/gnus-logic.el +++ b/lisp/gnus/gnus-logic.el @@ -162,9 +162,9 @@ (funcall type (or (aref gnus-advanced-headers index) 0) match))) (defun gnus-advanced-date (index match type) - (let ((date (apply 'encode-time (parse-time-string - (aref gnus-advanced-headers index)))) - (match (apply 'encode-time (parse-time-string match)))) + (let ((date (encode-time (parse-time-string + (aref gnus-advanced-headers index)))) + (match (encode-time (parse-time-string match)))) (cond ((eq type 'at) (equal date match)) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 9d5445c18c..b0674525a8 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5542,7 +5542,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'." (let* ((cur (decode-time)) (nday (+ days (nth 3 cur)))) (setf (nth 3 cur) nday) - (message-make-date (apply 'encode-time cur)))) + (message-make-date (encode-time cur)))) (defun message-make-message-id () "Make a unique Message-ID." diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index 3798be1058..c8b7eed987 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -1278,27 +1278,27 @@ all. This may very well take some time.") (push (cond ((eq (cdr reminder) 'minute) (time-subtract - (apply 'encode-time 0 (nthcdr 1 date-elts)) + (apply #'encode-time 0 (nthcdr 1 date-elts)) (encode-time (* (car reminder) 60.0)))) ((eq (cdr reminder) 'hour) (time-subtract - (apply 'encode-time 0 0 (nthcdr 2 date-elts)) + (apply #'encode-time 0 0 (nthcdr 2 date-elts)) (encode-time (* (car reminder) 3600.0)))) ((eq (cdr reminder) 'day) (time-subtract - (apply 'encode-time 0 0 0 (nthcdr 3 date-elts)) + (apply #'encode-time 0 0 0 (nthcdr 3 date-elts)) (encode-time (* (car reminder) 86400.0)))) ((eq (cdr reminder) 'week) (time-subtract - (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts)) + (apply #'encode-time 0 0 0 monday (nthcdr 4 date-elts)) (encode-time (* (car reminder) 604800.0)))) ((eq (cdr reminder) 'month) (time-subtract - (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts)) + (apply #'encode-time 0 0 0 1 (nthcdr 4 date-elts)) (encode-time (* (car reminder) 18748800.0)))) ((eq (cdr reminder) 'year) (time-subtract - (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) + (apply #'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) (encode-time (* (car reminder) 400861056.0))))) res)) (sort res 'time-less-p))) diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 66006573c1..81377c9c41 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -294,7 +294,7 @@ a list of address strings." (defun ietf-drums-parse-date (string) "Return an Emacs time spec from STRING." - (apply 'encode-time (parse-time-string string))) + (encode-time (parse-time-string string))) (defun ietf-drums-narrow-to-header () "Narrow to the header section in the current buffer." diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index db8ed16ee0..1632ee1375 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -629,7 +629,7 @@ disallows them." (<= time-zone-minute 59)) (error "Invalid or unsupported time: %s" date-time-string)) ;; Return a value in a format similar to that returned by decode-time, and - ;; suitable for (apply 'encode-time ...). + ;; suitable for (apply #'encode-time ...). (list second minute hour day month year second-fraction datatype (if has-time-zone (* (rng-xsd-time-to-seconds diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index b9b1e4aab6..34faf4ce28 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -488,9 +488,9 @@ Emacs dired can't find files." "Sort \"ls\" output by time, descending." (let (time-a time-b) (string-match tramp-adb-ls-date-regexp a) - (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) + (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a)))) (string-match tramp-adb-ls-date-regexp b) - (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) + (setq time-b (apply #'encode-time (parse-time-string (match-string 0 b)))) (time-less-p time-b time-a))) (defun tramp-adb-ls-output-name-less-p (a b) diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 6cc5214306..d491dff477 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -5491,8 +5491,8 @@ displayed in agenda view." (substring (format-time-string (car org-time-stamp-formats) - (apply #'encode-time ; DATE bound by calendar - (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) + (encode-time ; DATE bound by calendar + 0 0 0 (nth 1 date) (car date) (nth 2 date))) 1 11)) "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)" "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) @@ -5742,8 +5742,8 @@ then those holidays will be skipped." (substring (format-time-string (car org-time-stamp-formats) - (apply 'encode-time ; DATE bound by calendar - (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) + (encode-time ; DATE bound by calendar + 0 0 0 (nth 1 date) (car date) (nth 2 date))) 1 11)))) (org-agenda-search-headline-for-time nil) marker hdmarker priority category level tags closedp @@ -5860,10 +5860,8 @@ See also the user option `org-agenda-clock-consistency-checks'." (throw 'next t)) (setq ts (match-string 1) te (match-string 3) - ts (float-time - (apply #'encode-time (org-parse-time-string ts))) - te (float-time - (apply #'encode-time (org-parse-time-string te))) + ts (float-time (org-time-string-to-time ts)) + te (float-time (org-time-string-to-time te)) dt (- te ts)))) (cond ((> dt (* 60 maxtime)) diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index a699d2e28f..0c7f159369 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -1009,9 +1009,8 @@ Store them in the capture property list." (not (= (time-to-days prompt-time) (org-today)))) ;; Use 00:00 when no time is given for another ;; date than today? - (apply #'encode-time - (append '(0 0 0) - (cl-cdddr (decode-time prompt-time))))) + (apply #'encode-time 0 0 0 + (cl-cdddr (decode-time prompt-time)))) ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" org-read-date-final-answer) ;; Replace any time range by its start. diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index b177450d33..babf1f7066 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -723,8 +723,8 @@ menu\nmouse-2 will jump to task")) The time returned includes the time spent on this task in previous clocking intervals." (let ((currently-clocked-time - (floor (- (float-time) - (float-time org-clock-start-time)) 60))) + (floor (encode-time (time-subtract nil org-clock-start-time) 'integer) + 60))) (+ currently-clocked-time (or org-clock-total-time 0)))) (defun org-clock-modify-effort-estimate (&optional value) @@ -1033,8 +1033,9 @@ to be CLOCKED OUT.")))) nil 45))) (and (not (memq char-pressed '(?i ?q))) char-pressed))))) (default - (floor (/ (float-time - (time-subtract (current-time) last-valid)) 60))) + (floor (encode-time (time-subtract (current-time) last-valid) + 'integer) + 60)) (keep (and (memq ch '(?k ?K)) (read-number "Keep how many minutes? " default))) @@ -1102,8 +1103,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling (lambda (clock) (format "Dangling clock started %d mins ago" - (floor (- (float-time) - (float-time (cdr clock))) + (floor (encode-time (time-subtract nil (cdr clock)) + 'integer) 60))))) (or last-valid (cdr clock))))))))))) @@ -1293,8 +1294,7 @@ the default behavior." (setq ts (concat "[" (match-string 1) "]")) (goto-char (match-end 1)) (setq org-clock-start-time - (apply 'encode-time - (org-parse-time-string (match-string 1)))) + (org-time-string-to-time (match-string 1))) (setq org-clock-effort (org-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start)))) @@ -1431,7 +1431,7 @@ The time is always returned as UTC." (day (nth 3 dt))) (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) (setf (nth 2 dt) org-extend-today-until) - (apply #'encode-time (append (list 0 0) (nthcdr 2 dt))))) + (apply #'encode-time 0 0 (nthcdr 2 dt)))) ((or (equal cmt "all") (and (or (not cmt) (equal cmt "auto")) (not lr))) @@ -1577,14 +1577,12 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." (delete-region (point) (point-at-eol)) (insert "--") (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) - (setq s (- (float-time - (apply #'encode-time (org-parse-time-string te))) - (float-time - (apply #'encode-time (org-parse-time-string ts)))) - h (floor (/ s 3600)) + (setq s (float-time (time-subtract + (org-time-string-to-time te) + (org-time-string-to-time ts))) + h (floor s 3600) s (- s (* 3600 h)) - m (floor (/ s 60)) - s (- s (* 60 s))) + m (floor s 60)) (insert " => " (format "%2d:%02d" h m)) (move-marker org-clock-marker nil) (move-marker org-clock-hd-marker nil) @@ -1813,15 +1811,15 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." ((match-end 2) ;; Two time stamps. (let* ((ts (float-time - (apply #'encode-time - (save-match-data - (org-parse-time-string (match-string 2)))))) + (encode-time + (save-match-data + (org-parse-time-string (match-string 2)))))) (te (float-time - (apply #'encode-time - (org-parse-time-string (match-string 3))))) + (encode-time + (org-parse-time-string (match-string 3))))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) - (when (> dt 0) (cl-incf t1 (floor (/ dt 60)))))) + (when (> dt 0) (cl-incf t1 (floor dt 60))))) ((match-end 4) ;; A naked time. (setq t1 (+ t1 (string-to-number (match-string 5)) @@ -2704,14 +2702,14 @@ LEVEL is an integer. Indent by two spaces per level above 1." (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts))) (setq ts (float-time (encode-time 0 0 0 day month year))))) (ts - (setq ts (float-time (apply #'encode-time (org-parse-time-string ts)))))) + (setq ts (float-time (org-time-string-to-time ts))))) (cond ((numberp te) ;; Likewise for te. (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te))) (setq te (float-time (encode-time 0 0 0 day month year))))) (te - (setq te (float-time (apply #'encode-time (org-parse-time-string te)))))) + (setq te (float-time (org-time-string-to-time te))))) (setq tsb (if (eq step0 'week) (let ((dow (nth 6 (decode-time (encode-time ts))))) @@ -2720,7 +2718,7 @@ LEVEL is an integer. Indent by two spaces per level above 1." ts)) (while (< tsb te) (unless (bolp) (insert "\n")) - (let ((start-time (encode-time (max tsb ts)))) + (let ((start-time (max tsb ts))) (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb))))) (if (or (eq step0 'day) (= dow ws)) @@ -2882,18 +2880,16 @@ Otherwise, return nil." (<= org-clock-marker (point-at-eol))) ;; The clock is running here (setq org-clock-start-time - (apply 'encode-time - (org-parse-time-string (match-string 1)))) + (org-time-string-to-time (match-string 1))) (org-clock-update-mode-line))) (t (and (match-end 4) (delete-region (match-beginning 4) (match-end 4))) (end-of-line 1) (setq ts (match-string 1) te (match-string 3)) - (setq s (- (float-time - (apply #'encode-time (org-parse-time-string te))) - (float-time - (apply #'encode-time (org-parse-time-string ts)))) + (setq s (float-time + (time-subtract (org-time-string-to-time te) + (org-time-string-to-time ts))) neg (< s 0) s (abs s) h (floor (/ s 3600)) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 2c34eddcf6..f3e118b6de 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -719,7 +719,7 @@ around it." (setq time-after (copy-sequence time)) (setf (nth 3 time-before) (1- (nth 3 time))) (setf (nth 3 time-after) (1+ (nth 3 time))) - (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x))) + (mapcar (lambda (x) (format-time-string fmt (encode-time x))) (list time-before time time-after))))) (defun org-columns-open-link (&optional arg) @@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in (cond ((string-match-p org-ts-regexp s) (/ (- org-columns--time - (float-time (apply #'encode-time (org-parse-time-string s)))) + (float-time (org-time-string-to-time s))) 60)) ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units (t (user-error "Invalid age: %S" s)))) diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el index 7d04d02970..a151e1e846 100644 --- a/lisp/org/org-macro.el +++ b/lisp/org/org-macro.el @@ -313,7 +313,7 @@ Return a list of arguments, as strings. This is the opposite of (buffer-substring (point) (line-end-position))))) (when (cl-some #'identity time) - (setq date (apply #'encode-time time)))))))) + (setq date (encode-time time)))))))) (let ((proc (get-buffer-process buf))) (while (and proc (accept-process-output proc .5 nil t))))) (kill-buffer buf)) diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 0a8382c8b5..81a77fde6c 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2909,8 +2909,8 @@ location of point." (format-time-string (org-time-stamp-format (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts)) - (apply #'encode-time - (save-match-data (org-parse-time-string ts)))))) + (encode-time + (save-match-data (org-parse-time-string ts)))))) form t t)) (setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form)) diff --git a/lisp/org/org.el b/lisp/org/org.el index 91a4799a21..b627282a63 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5613,16 +5613,15 @@ When ROUNDING-MINUTES is not an integer, fall back on the car of the rounding returns a past time." (let ((r (or (and (integerp rounding-minutes) rounding-minutes) (car org-time-stamp-rounding-minutes))) - (time (decode-time)) res) + (now (current-time))) (if (< r 1) - (current-time) - (setq res - (apply 'encode-time - (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) - (nthcdr 2 time)))) - (if (and past (< (float-time (time-subtract (current-time) res)) 0)) - (encode-time (- (float-time res) (* r 60))) - res)))) + now + (let* ((time (decode-time now)) + (res (apply #'encode-time 0 (* r (round (nth 1 time) r)) + (nthcdr 2 time)))) + (if (or (not past) (time-less-p res now)) + res + (time-subtract res (* r 60))))))) (defun org-today () "Return today date, considering `org-extend-today-until'." @@ -9743,9 +9742,7 @@ active region." (setq link (format-time-string (car org-time-stamp-formats) - (apply 'encode-time - (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) - nil nil nil)))) + (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)))) (org-store-link-props :type "calendar" :date cd))) ((eq major-mode 'help-mode) @@ -13344,7 +13341,7 @@ for calling org-schedule with, or if there is no scheduling, returns nil." (let ((time (org-entry-get pom "SCHEDULED" inherit))) (when time - (apply 'encode-time (org-parse-time-string time))))) + (org-time-string-to-time time)))) (defun org-get-deadline-time (pom &optional inherit) "Get the deadline as a time tuple, of a format suitable for @@ -13352,7 +13349,7 @@ calling org-deadline with, or if there is no scheduling, returns nil." (let ((time (org-entry-get pom "DEADLINE" inherit))) (when time - (apply 'encode-time (org-parse-time-string time))))) + (org-time-string-to-time time)))) (defun org-remove-timestamp-with-keyword (keyword) "Remove all time stamps with KEYWORD in the current entry." @@ -13411,7 +13408,7 @@ WHAT entry will also be removed." org-deadline-time-regexp) end t) (setq ts (match-string 1) - default-time (apply 'encode-time (org-parse-time-string ts)) + default-time (org-time-string-to-time ts) default-input (and ts (org-get-compact-tod ts))))))) (when what (setq time @@ -14668,7 +14665,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0." ((numberp s) s) ((stringp s) (condition-case nil - (float-time (apply #'encode-time (org-parse-time-string s))) + (float-time (org-time-string-to-time s)) (error 0.))) (t 0.))) @@ -14676,8 +14673,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0." "Time in seconds today at 0:00. Returns the float number of seconds since the beginning of the epoch to the beginning of today (00:00)." - (float-time (apply 'encode-time - (append '(0 0 0) (nthcdr 3 (decode-time)))))) + (float-time (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time))))) (defun org-matcher-time (s) "Interpret a time comparison value." @@ -16573,7 +16569,7 @@ non-nil." ;; Default time is either the timestamp at point or today. ;; When entering a range, only the range start is considered. (default-time (if (not ts) (current-time) - (apply #'encode-time (org-parse-time-string ts)))) + (org-time-string-to-time ts))) (default-input (and ts (org-get-compact-tod ts))) (repeater (and ts (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) @@ -16820,7 +16816,7 @@ user." (when (< (nth 2 org-defdecode) org-extend-today-until) (setf (nth 2 org-defdecode) -1) (setf (nth 1 org-defdecode) 59) - (setq org-def (apply #'encode-time org-defdecode)) + (setq org-def (encode-time org-defdecode)) (setq org-defdecode (decode-time org-def))) (let* ((timestr (format-time-string (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") @@ -16893,13 +16889,14 @@ user." "range representable on this machine")) (ding)) - ;; One round trip to get rid of 34th of August and stuff like that.... - (setq final (decode-time (apply 'encode-time final))) + (setq final (apply #'encode-time final)) (setq org-read-date-final-answer ans) (if to-time - (apply 'encode-time final) + final + ;; This round-trip gets rid of 34th of August and stuff like that.... + (setq final (decode-time final)) (if (and (boundp 'org-time-was-given) org-time-was-given) (format "%04d-%02d-%02d %02d:%02d" (nth 5 final) (nth 4 final) (nth 3 final) @@ -16929,7 +16926,7 @@ user." (and (boundp 'org-time-was-given) org-time-was-given)) (cdr fmts) (car fmts))) - (txt (format-time-string fmt (apply 'encode-time f))) + (txt (format-time-string fmt (apply #'encode-time f))) (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt)) (txt (concat "=> " txt))) (when (and org-end-time-was-given @@ -17296,7 +17293,7 @@ The command returns the inserted time stamp." time (org-fix-decoded-time t1) str (org-add-props (format-time-string - (substring tf 1 -1) (apply 'encode-time time)) + (substring tf 1 -1) (encode-time time)) nil 'mouse-face 'highlight)) (put-text-property beg end 'display str))) @@ -17553,7 +17550,7 @@ days in order to avoid rounding problems." (defun org-time-string-to-time (s) "Convert timestamp string S into internal time." - (apply #'encode-time (org-parse-time-string s))) + (encode-time (org-parse-time-string s))) (defun org-time-string-to-seconds (s) "Convert a timestamp string S into a number of seconds." @@ -17588,7 +17585,7 @@ signaled." (daynr (org-closest-date s daynr prefer)) (t (time-to-days (condition-case errdata - (apply #'encode-time (org-parse-time-string s)) + (org-time-string-to-time s) (error (error "Bad timestamp `%s'%s\nError was: %s" s (if (not (and buffer pos)) "" @@ -17686,12 +17683,12 @@ stamp stay unchanged. In any case, return value is an absolute day number." (if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start)) ;; No repeater. Do not shift time stamp. - (time-to-days (apply #'encode-time (org-parse-time-string start))) + (time-to-days (org-time-string-to-time start)) (let ((value (string-to-number (match-string 1 start))) (type (match-string 2 start))) (if (= 0 value) ;; Repeater with a 0-value is considered as void. - (time-to-days (apply #'encode-time (org-parse-time-string start))) + (time-to-days (org-time-string-to-time start)) (let* ((base (org-date-to-gregorian start)) (target (org-date-to-gregorian current)) (sday (calendar-absolute-from-gregorian base)) @@ -18000,7 +17997,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"." (setcar time0 (or (car time0) 0)) (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) - (setq time (apply 'encode-time time0)))) + (setq time (encode-time time0)))) ;; Insert the new time-stamp, and ensure point stays in the same ;; category as before (i.e. not after the last position in that ;; category). @@ -23389,13 +23386,12 @@ strictly within a source block, use appropriate comment syntax." (defun org-timestamp--to-internal-time (timestamp &optional end) "Encode TIMESTAMP object into Emacs internal time. Use end of date range or time range when END is non-nil." - (apply #'encode-time - (cons 0 - (mapcar - (lambda (prop) (or (org-element-property prop timestamp) 0)) - (if end '(:minute-end :hour-end :day-end :month-end :year-end) - '(:minute-start :hour-start :day-start :month-start - :year-start)))))) + (apply #'encode-time 0 + (mapcar + (lambda (prop) (or (org-element-property prop timestamp) 0)) + (if end '(:minute-end :hour-end :day-end :month-end :year-end) + '(:minute-start :hour-start :day-start :month-start + :year-start))))) (defun org-timestamp-has-time-p (timestamp) "Non-nil when TIMESTAMP has a time specified." diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index 2cc2b189a1..a4cf0f0ec0 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el @@ -146,7 +146,7 @@ Returns nil if WebDAV is not supported." (setq time (parse-time-string date-string))) (if time - (setq time (apply 'encode-time time)) + (setq time (encode-time time)) (url-debug 'dav "Unable to decode date (%S) (%s)" (xml-node-name node) date-string)) time)) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 5df0a287d3..a4ff1cb4cd 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -650,7 +650,7 @@ Optional arg REVISION is a revision to annotate from." "Return the current time, based at midnight of the current day, and encoded as fractional days." (vc-annotate-convert-time - (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time))))) + (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time))))) (defun vc-cvs-annotate-time () "Return the time of the next annotation (as fraction of days) @@ -1184,9 +1184,8 @@ is non-nil." (car parsed-time) ;; Compare just the seconds part of the file time, ;; since CVS file time stamp resolution is just 1 second. - (let ((ptime (apply 'encode-time parsed-time))) - (and (eq (car mtime) (car ptime)) - (eq (cadr mtime) (cadr ptime))))) + (= (encode-time mtime 'integer) + (encode-time parsed-time 'integer))) (vc-file-setprop file 'vc-checkout-time mtime) (if set-state (vc-file-setprop file 'vc-state 'up-to-date))) (t commit 3eb63da19579824801a169a03b9de7bdd945eaa6 Author: Paul Eggert Date: Sun Feb 10 23:47:43 2019 -0800 Fix doc string treatment of integer overflow * lisp/calendar/cal-dst.el (calendar-dst-find-startend): Fix doc string. diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el index 567ba9c8a1..57747c64f6 100644 --- a/lisp/calendar/cal-dst.el +++ b/lisp/calendar/cal-dst.el @@ -279,8 +279,8 @@ expressions that when evaluated return the start and end dates, respectively. This function first attempts to use pre-calculated data from `calendar-dst-transition-cache', otherwise it calls `calendar-dst-find-data' (and adds the results to the cache). -If dates in YEAR cannot be handled by `encode-time' (e.g. if they -are too large to be represented as a lisp integer), then rather +If dates in YEAR cannot be handled by `encode-time' (e.g., +if they are out of range for POSIX time_t), then rather than an error this function returns the result appropriate for the current year." (let ((e (assoc year calendar-dst-transition-cache)) commit 57c74793c46c6533b63836f00aecaf3ac2accb6d Author: Paul Eggert Date: Sun Feb 10 23:47:43 2019 -0800 Prefer encode-time to its alias * lisp/calendar/icalendar.el, lisp/calendar/timeclock.el: * lisp/emacs-lisp/timer.el, lisp/gnus/gnus-delay.el: * lisp/gnus/gnus-sum.el, lisp/gnus/nndiary.el: * lisp/gnus/nnrss.el, lisp/net/newst-backend.el: * lisp/net/rcirc.el, lisp/obsolete/xesam.el: * lisp/org/org-agenda.el, lisp/org/org-clock.el: * lisp/org/org-element.el, lisp/org/org-timer.el: * lisp/org/org.el, lisp/progmodes/flymake.el: * lisp/url/url-cache.el, lisp/url/url-cookie.el: Use encode-time instead of its alias seconds-to-time. diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 3bcb7520e2..31ace6fb9b 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -1621,7 +1621,7 @@ enumeration, given as a time value, in same format as returned by (mapcar (lambda (offset) (let* ((day (decode-time (time-add now - (seconds-to-time + (encode-time (* offset 60 60 24))))) (d (nth 3 day)) (m (nth 4 day)) diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 0562f4a998..fd6f5310c8 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -528,7 +528,7 @@ non-nil, the amount returned will be relative to past time worked." "Return a time value representing the end of today's workday. If TODAY-ONLY is non-nil, the value returned will be relative only to the time worked today, and not to past time." - (seconds-to-time + (encode-time (- (float-time) (let ((discrep (timeclock-find-discrep))) (if discrep @@ -1196,7 +1196,7 @@ HTML-P is non-nil, HTML markup is added." (insert project "
\n") (insert project "*\n")) (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) - (two-weeks-ago (seconds-to-time + (two-weeks-ago (encode-time (- (float-time today) (* 2 7 24 60 60)))) two-week-len today-len) @@ -1249,16 +1249,16 @@ HTML-P is non-nil, HTML markup is added." -1 year ") (let* ((day-list (timeclock-day-list)) - (thirty-days-ago (seconds-to-time + (thirty-days-ago (encode-time (- (float-time today) (* 30 24 60 60)))) - (three-months-ago (seconds-to-time + (three-months-ago (encode-time (- (float-time today) (* 90 24 60 60)))) - (six-months-ago (seconds-to-time + (six-months-ago (encode-time (- (float-time today) (* 180 24 60 60)))) - (one-year-ago (seconds-to-time + (one-year-ago (encode-time (- (float-time today) (* 365 24 60 60)))) (time-in (vector (list t) (list t) (list t) (list t) (list t))) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 4bd19b74a9..f77c945786 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -88,7 +88,7 @@ SECS may be an integer, floating point number, or the internal time format returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." - (setf (timer--time timer) (if (consp secs) secs (seconds-to-time secs))) + (setf (timer--time timer) (if (consp secs) secs (encode-time secs))) (setf (timer--repeat-delay timer) repeat) timer) diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el index d1ff7e6116..e013f26adf 100644 --- a/lisp/gnus/gnus-delay.el +++ b/lisp/gnus/gnus-delay.el @@ -110,7 +110,7 @@ DELAY is a string, giving the length of the time. Possible values are: (setq deadline (+ 86400 deadline))) ; 86400 secs/day ;; Convert seconds to date header. (setq deadline (message-make-date - (seconds-to-time deadline)))) + (encode-time deadline)))) ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay) (setq num (match-string 1 delay)) (setq unit (match-string 2 delay)) @@ -129,7 +129,7 @@ DELAY is a string, giving the length of the time. Possible values are: (t (setq delay (* num 60)))) (setq deadline (message-make-date - (seconds-to-time (+ (float-time) delay))))) + (encode-time (+ (float-time) delay))))) (t (error "Malformed delay `%s'" delay))) (message-add-header (format "%s: %s" gnus-delay-header deadline))) (set-buffer-modified-p t) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 911bf89f23..3a5886a863 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -3868,7 +3868,7 @@ Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"." (setq top (eval (caar templist))))) (if (stringp (cdr (car templist))) (setq my-format (cdr (car templist))))) - (format-time-string (eval my-format) (seconds-to-time messy-date))) + (format-time-string (eval my-format) (encode-time messy-date))) (error " ? "))) (defun gnus-summary-set-local-parameters (group) diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index c65f78d308..3798be1058 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -1279,27 +1279,27 @@ all. This may very well take some time.") (cond ((eq (cdr reminder) 'minute) (time-subtract (apply 'encode-time 0 (nthcdr 1 date-elts)) - (seconds-to-time (* (car reminder) 60.0)))) + (encode-time (* (car reminder) 60.0)))) ((eq (cdr reminder) 'hour) (time-subtract (apply 'encode-time 0 0 (nthcdr 2 date-elts)) - (seconds-to-time (* (car reminder) 3600.0)))) + (encode-time (* (car reminder) 3600.0)))) ((eq (cdr reminder) 'day) (time-subtract (apply 'encode-time 0 0 0 (nthcdr 3 date-elts)) - (seconds-to-time (* (car reminder) 86400.0)))) + (encode-time (* (car reminder) 86400.0)))) ((eq (cdr reminder) 'week) (time-subtract (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts)) - (seconds-to-time (* (car reminder) 604800.0)))) + (encode-time (* (car reminder) 604800.0)))) ((eq (cdr reminder) 'month) (time-subtract (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts)) - (seconds-to-time (* (car reminder) 18748800.0)))) + (encode-time (* (car reminder) 18748800.0)))) ((eq (cdr reminder) 'year) (time-subtract (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) - (seconds-to-time (* (car reminder) 400861056.0))))) + (encode-time (* (car reminder) 400861056.0))))) res)) (sort res 'time-less-p))) diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index db37e24b90..6a47596664 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el @@ -454,7 +454,7 @@ which RSS 2.0 allows." (cond ((null date)) ; do nothing for this case ;; if the date is just digits (unix time stamp): ((string-match "^[0-9]+$" date) - (setq given (seconds-to-time (string-to-number date)))) + (setq given (encode-time (string-to-number date)))) ;; RFC822 ((string-match " [0-9]+ " date) (setq vector (timezone-parse-date date) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 61c743755b..ac58ed9fa7 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1802,7 +1802,7 @@ download it from URL first." (time-less-p nil (time-add (file-attribute-modification-time (file-attributes image-name)) - (seconds-to-time 86400)))) + (encode-time 86400)))) (newsticker--debug-msg "%s: Getting image for %s skipped" (format-time-string "%A, %H:%M") feed-name) @@ -1996,7 +1996,7 @@ older than TIME." (lambda (item) (when (eq (newsticker--age item) old-age) (let ((exp-time (time-add (newsticker--time item) - (seconds-to-time time)))) + (encode-time time)))) (when (time-less-p exp-time nil) (newsticker--debug-msg "Item `%s' from %s has expired on %s" diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 47681ccfe7..24f1c424dc 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -2794,7 +2794,7 @@ the only argument." (let* ((nick (nth 1 args)) (idle-secs (string-to-number (nth 2 args))) (idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs)) - (signon-time (seconds-to-time (string-to-number (nth 3 args)))) + (signon-time (encode-time (string-to-number (nth 3 args)))) (signon-string (format-time-string "%c" signon-time)) (message (format "%s idle for %s, signed on %s" nick idle-string signon-string))) @@ -2815,7 +2815,7 @@ Not in rfc1459.txt" (with-current-buffer buffer (let ((setter (nth 2 args)) (time (current-time-string - (seconds-to-time + (encode-time (string-to-number (cl-cadddr args)))))) (rcirc-print process sender "TOPIC" (cadr args) (format "%s (%s on %s)" rcirc-topic setter time)))))) diff --git a/lisp/obsolete/xesam.el b/lisp/obsolete/xesam.el index 95ddb2c0b8..a1a4639a23 100644 --- a/lisp/obsolete/xesam.el +++ b/lisp/obsolete/xesam.el @@ -622,7 +622,7 @@ Return propertized STRING." (or (widget-get widget :tag) "") (format-time-string "%d %B %Y, %T" - (seconds-to-time + (encode-time (string-to-number (widget-get widget :xesam:sourceModified))))))) ;; Second line: :value. diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 6f66807ab5..6cc5214306 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -5914,8 +5914,8 @@ See also the user option `org-agenda-clock-consistency-checks'." (throw 'exit t)) ;; We have a shorter gap. ;; Now we have to get the minute of the day when these times are - (let* ((t1dec (decode-time (seconds-to-time t1))) - (t2dec (decode-time (seconds-to-time t2))) + (let* ((t1dec (decode-time (encode-time t1))) + (t2dec (decode-time (encode-time t2))) ;; compute the minute on the day (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec)))) (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec))))) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 9d05c836da..b177450d33 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -1069,10 +1069,10 @@ to be CLOCKED OUT.")))) (and gotback (= gotback default))) 'now) (keep - (time-add last-valid (seconds-to-time (* 60 keep)))) + (time-add last-valid (encode-time (* 60 keep)))) (gotback (time-subtract (current-time) - (seconds-to-time (* 60 gotback)))) + (encode-time (* 60 gotback)))) (t (error "Unexpected, please report this as a bug"))) (and gotback last-valid) @@ -1155,7 +1155,7 @@ so long." (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) (org-clock-user-idle-start (time-subtract (current-time) - (seconds-to-time org-clock-user-idle-seconds))) + (encode-time org-clock-user-idle-seconds))) (org-clock-resolving-clocks-due-to-idleness t)) (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) (org-clock-resolve @@ -2714,14 +2714,14 @@ LEVEL is an integer. Indent by two spaces per level above 1." (setq te (float-time (apply #'encode-time (org-parse-time-string te)))))) (setq tsb (if (eq step0 'week) - (let ((dow (nth 6 (decode-time (seconds-to-time ts))))) + (let ((dow (nth 6 (decode-time (encode-time ts))))) (if (<= dow ws) ts (- ts (* 86400 (- dow ws))))) ts)) (while (< tsb te) (unless (bolp) (insert "\n")) - (let ((start-time (seconds-to-time (max tsb ts)))) - (cl-incf tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb))))) + (let ((start-time (encode-time (max tsb ts)))) + (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb))))) (if (or (eq step0 'day) (= dow ws)) step @@ -2741,7 +2741,7 @@ LEVEL is an integer. Indent by two spaces per level above 1." :tstart (format-time-string (org-time-stamp-format t t) start-time) :tend (format-time-string (org-time-stamp-format t t) - (seconds-to-time (min te tsb)))))))) + (encode-time (min te tsb)))))))) (re-search-forward "^[ \t]*#\\+END:") (when (and stepskip0 (equal step-time 0)) ;; Remove the empty table diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 75d46e2312..e2ee0a0fe8 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -4765,13 +4765,13 @@ you want to help debugging the issue.") (defvar org-element-cache-sync-idle-time 0.6 "Length, in seconds, of idle time before syncing cache.") -(defvar org-element-cache-sync-duration (seconds-to-time 0.04) +(defvar org-element-cache-sync-duration (encode-time 0.04) "Maximum duration, as a time value, for a cache synchronization. If the synchronization is not over after this delay, the process pauses and resumes after `org-element-cache-sync-break' seconds.") -(defvar org-element-cache-sync-break (seconds-to-time 0.3) +(defvar org-element-cache-sync-break (encode-time 0.3) "Duration, as a time value, of the pause between synchronizations. See `org-element-cache-sync-duration' for more information.") diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index bf17de4b03..c9ca85c0c3 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -140,7 +140,7 @@ the region 0:00:00." (unless (string-match "\\S-" s) (setq s def)) (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) (setq org-timer-start-time - (seconds-to-time + (encode-time ;; Pass `current-time' result to `float-time' (instead ;; of calling without arguments) so that only ;; `current-time' has to be overridden in tests. @@ -168,12 +168,12 @@ With prefix arg STOP, stop it entirely." (org-timer--run-countdown-timer new-secs org-timer-countdown-timer-title)) (setq org-timer-start-time - (time-add (current-time) (seconds-to-time new-secs)))) + (time-add (current-time) (encode-time new-secs)))) (setq org-timer-start-time ;; Pass `current-time' result to `float-time' (instead ;; of calling without arguments) so that only ;; `current-time' has to be overridden in tests. - (seconds-to-time (- (float-time (current-time)) + (encode-time (- (float-time (current-time)) (- pause-secs start-secs))))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on) @@ -464,7 +464,7 @@ using three `C-u' prefix arguments." secs org-timer-countdown-timer-title)) (run-hooks 'org-timer-set-hook) (setq org-timer-start-time - (time-add (current-time) (seconds-to-time secs))) + (time-add (current-time) (encode-time secs))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on)))))) diff --git a/lisp/org/org.el b/lisp/org/org.el index ef45ee6615..91a4799a21 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5621,7 +5621,7 @@ the rounding returns a past time." (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) (nthcdr 2 time)))) (if (and past (< (float-time (time-subtract (current-time) res)) 0)) - (seconds-to-time (- (float-time res) (* r 60))) + (encode-time (- (float-time res) (* r 60))) res)))) (defun org-today () @@ -17796,7 +17796,7 @@ NODEFAULT, hour and minute fields will be nil if not given." ;; second argument. However, this requires at least Emacs ;; 25.1. We can do it when we switch to this version as our ;; minimal requirement. - (decode-time (seconds-to-time (org-matcher-time s)))) + (decode-time (encode-time (org-matcher-time s)))) (t (error "Not a standard Org time string: %s" s)))) (defun org-timestamp-up (&optional arg) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index d991ccafc9..261e50a613 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1004,7 +1004,7 @@ Do it only if `flymake-no-changes-timeout' is non-nil." (setq flymake-timer (run-with-idle-timer - (seconds-to-time flymake-no-changes-timeout) + (encode-time flymake-no-changes-timeout) nil (lambda (buffer) (when (buffer-live-p buffer) diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el index 66a7223bc8..a1cb0b9274 100644 --- a/lisp/url/url-cache.el +++ b/lisp/url/url-cache.el @@ -205,7 +205,7 @@ If `url-standalone-mode' is non-nil, cached items never expire." (time-less-p (time-add cache-time - (seconds-to-time (or expire-time url-cache-expire-time))) + (encode-time (or expire-time url-cache-expire-time))) nil))))) (defun url-cache-prune-cache (&optional directory) @@ -227,7 +227,7 @@ considered \"expired\"." ((time-less-p (time-add (file-attribute-modification-time (file-attributes file)) - (seconds-to-time url-cache-expire-time)) + (encode-time url-cache-expire-time)) now) (delete-file file) (setq deleted-files (1+ deleted-files)))))) diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index 0c27638818..213dab268c 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el @@ -105,10 +105,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." ;; away, make it expire a year from now (expires (format-time-string "%d %b %Y %T [GMT]" - (seconds-to-time + (encode-time (let ((s (string-to-number (nth 4 fields)))) (if (and (= s 0) long-session) - (seconds-to-time (+ (* 365 24 60 60) (float-time))) + (encode-time (+ (* 365 24 60 60) (float-time))) s))))) (key (nth 5 fields)) (val (nth 6 fields))) commit 54b9ee77adca44299fe8f4342498a082608b4d1b Author: Stefan Monnier Date: Sun Feb 10 18:12:05 2019 -0500 * test/lisp/emacs-lisp/package-tests.el: Allow extra extras (package-test--compatible-p): New function. (package-test-desc-from-buffer, package-test-install-single): Use it. (package-x-test-upload-buffer, package-x-test-upload-new-version): Don't burp in presence of extra extras. diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 8f021bf6fc..c757bccf67 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -190,12 +190,33 @@ Must called from within a `tar-mode' buffer." "Return the package version as a string." (package-version-join (package-desc-version desc))) +(defun package-test--compatible-p (pkg-desc pkg-sample &optional kind) + (and (cl-every (lambda (f) + (equal (funcall f pkg-desc) + (funcall f pkg-sample))) + (cons (if kind #'package-desc-kind #'ignore) + '(package-desc-name + package-desc-version + package-desc-summary + package-desc-reqs + package-desc-archive + package-desc-dir + package-desc-signed))) + ;; The `extras' field should contain at least the specified elements. + (let ((extras (package-desc-extras pkg-desc)) + (extras-sample (package-desc-extras pkg-sample))) + (cl-every (lambda (sample-elem) + (member sample-elem extras)) + extras-sample)))) + (ert-deftest package-test-desc-from-buffer () "Parse an elisp buffer to get a `package-desc' object." (with-package-test (:basedir "package-resources" :file "simple-single-1.3.el") - (should (equal (package-buffer-info) simple-single-desc))) + (should (package-test--compatible-p + (package-buffer-info) simple-single-desc 'kind))) (with-package-test (:basedir "package-resources" :file "simple-depend-1.0.el") - (should (equal (package-buffer-info) simple-depend-desc))) + (should (package-test--compatible-p + (package-buffer-info) simple-depend-desc 'kind))) (with-package-test (:basedir "package-resources" :file "multi-file-0.2.3.tar") (tar-mode) @@ -223,15 +244,12 @@ Must called from within a `tar-mode' buffer." (with-temp-buffer (insert-file-contents (expand-file-name "simple-single-pkg.el" simple-pkg-dir)) - (should (string= (buffer-string) - (concat ";;; -*- no-byte-compile: t -*-\n" - "(define-package \"simple-single\" \"1.3\" " - "\"A single-file package " - "with no dependencies\" 'nil " - ":authors '((\"J. R. Hacker\" . \"jrh@example.com\")) " - ":maintainer '(\"J. R. Hacker\" . \"jrh@example.com\") " - ":url \"http://doodles.au\"" - ")\n")))) + (goto-char (point-min)) + (let ((sexp (read (current-buffer)))) + (should (eq (car-safe sexp) 'define-package)) + (should (package-test--compatible-p + (apply #'package-desc-from-define (cdr sexp)) + simple-single-desc)))) (should (file-exists-p autoloads-file)) (should-not (get-file-buffer autoloads-file))))) @@ -580,8 +598,17 @@ Must called from within a `tar-mode' buffer." (setq archive-contents (package-read-from-string (buffer-substring (point-min) (point-max))))) - (should (equal archive-contents - (list 1 package-x-test--single-archive-entry-1-3)))))) + (should (equal 1 (car archive-contents))) + (should (equal 2 (length archive-contents))) + (let ((pac (cadr archive-contents)) + (pac-sample package-x-test--single-archive-entry-1-3)) + (should (equal (pop pac) (pop pac-sample))) + (dotimes (i 4) + (should (equal (aref pac i) (aref pac-sample i)))) + ;; The `extras' field should contain at least the specified elements. + (should (cl-every (lambda (sample-elem) + (member sample-elem (aref pac 4))) + (aref pac-sample 4))))))) (ert-deftest package-x-test-upload-new-version () "Test uploading a new version of a package" @@ -601,8 +628,17 @@ Must called from within a `tar-mode' buffer." (setq archive-contents (package-read-from-string (buffer-substring (point-min) (point-max))))) - (should (equal archive-contents - (list 1 package-x-test--single-archive-entry-1-4)))))) + (should (equal 1 (car archive-contents))) + (should (equal 2 (length archive-contents))) + (let ((pac (cadr archive-contents)) + (pac-sample package-x-test--single-archive-entry-1-4)) + (should (equal (pop pac) (pop pac-sample))) + (dotimes (i 4) + (should (equal (aref pac i) (aref pac-sample i)))) + ;; The `extras' field should contain at least the specified elements. + (should (cl-every (lambda (sample-elem) + (member sample-elem (aref pac 4))) + (aref pac-sample 4))))))) (ert-deftest package-test-get-deps () "Test `package--get-deps' with complex structures." commit c8c6ad2429db961fb9410b25fec44b45da96efa1 Author: Mattias Engdegård Date: Sun Feb 10 10:39:00 2019 +0100 Document that [:cntrl:] does not match DEL (Bug#34391) * doc/lispref/searching.texi (Character Classes): * lisp/emacs-lisp/rx.el (rx): Document that [:cntrl:] excludes DEL. * test/src/regex-emacs-tests.el (regex-tests-PTESTS-whitelist): Swap misplaced comments and fix wrong code for DEL. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 05fc328205..cfbd2449b1 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -559,7 +559,7 @@ tabs, and other characters whose Unicode @samp{general-category} property (@pxref{Character Properties}) indicates they are spacing separators. @item [:cntrl:] -This matches any @acronym{ASCII} control character. +This matches any character whose code is in the range 0--31. @item [:digit:] This matches @samp{0} through @samp{9}. Thus, @samp{[-+[:digit:]]} matches any digit, as well as @samp{+} and @samp{-}. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 8b4551d0d3..3fa0204a1a 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -964,7 +964,7 @@ CHAR matches 0 through 9. `control', `cntrl' - matches ASCII control characters. + matches any character whose code is in the range 0-31. `hex-digit', `hex', `xdigit' matches 0 through 9, a through f and A through F. diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index e84af6b131..9a40316573 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -555,11 +555,11 @@ differences in behavior.") (defconst regex-tests-PTESTS-whitelist [ - ;; emacs doesn't barf on weird ranges such as [b-a], but simply - ;; fails to match + ;; emacs doesn't see DEL (0x7f) as a [:cntrl:] character 138 - ;; emacs doesn't see DEL (0x78) as a [:cntrl:] character + ;; emacs doesn't barf on weird ranges such as [b-a], but simply + ;; fails to match 168 ] "Line numbers in the PTESTS test that should be skipped. These commit 459869a528ff02787255391ab90f68195c27b807 Author: João Távora Date: Sun Feb 10 21:38:46 2019 +0000 Properly remove stale Flymake diagnostics on :region reports Among other bugs fixed, modifying a list structure while iterating it is a no-no. This would again cause duplicate diagnostics. See https://github.com/joaotavora/eglot/issues/223 for an example. * lisp/progmodes/flymake.el (Version): Bump to 1.0.5 (flymake--handle-report): Use cl-loop. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 15a4d25985..d991ccafc9 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.4 +;; Version: 1.0.5 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools @@ -742,14 +742,13 @@ report applies to that region." ;; the associated overlay. (cond (region - (dolist (diag (flymake--backend-state-diags state)) - (let ((diag-beg (flymake--diag-beg diag)) - (diag-end (flymake--diag-beg diag))) - (when (and (< diag-beg (cdr region)) - (> diag-end (car region))) - (delete-overlay (flymake--diag-overlay diag)) - (setf (flymake--backend-state-diags state) - (delq diag (flymake--backend-state-diags state))))))) + (cl-loop for diag in (flymake--backend-state-diags state) + if (or (> (flymake--diag-end diag) (car region)) + (< (flymake--diag-beg diag) (cdr region))) + do (delete-overlay (flymake--diag-overlay diag)) + else collect diag into surviving + finally (setf (flymake--backend-state-diags state) + surviving))) (first-report (dolist (diag (flymake--backend-state-diags state)) (delete-overlay (flymake--diag-overlay diag))) commit 24695e8977c3d048e60d1fe3714b789567c2213c Author: Eli Zaretskii Date: Sun Feb 10 17:10:04 2019 +0200 Unbreak the Cygw32 build * src/emacs.c (main) [HAVE_NTGUI]: Remove code that is only for WINDOWSNT or condition it on WINDOWSNT. (Bug#34409) diff --git a/src/emacs.c b/src/emacs.c index 3f964a1604..e16e230b4a 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -912,7 +912,7 @@ main (int argc, char **argv) gflags.will_not_unexec_ = true; #endif -#if defined WINDOWSNT || defined HAVE_NTGUI +#ifdef WINDOWSNT /* Grab our malloc arena space now, before anything important happens. This relies on the static heap being needed only in temacs and only if we are going to dump with unexec. */ @@ -934,6 +934,8 @@ main (int argc, char **argv) } } init_heap (use_dynamic_heap); +#endif +#if defined WINDOWSNT || defined HAVE_NTGUI /* Set global variables used to detect Windows version. Do this as early as possible. (w32proc.c calls this function as well, but the additional call here is harmless.) */ commit b78363eb0f51126b2c22d26ea1b91f6e4569e167 Author: João Távora Date: Sun Feb 10 12:05:52 2019 +0000 Cleanup stale diagnostics on Flymake restart Not doing so would cause duplicate diagnostics. See https://github.com/joaotavora/eglot/issues/223 for an example. * lisp/progmodes/flymake.el (Version): 1.0.4 (flymake-mode): Cleanup overlays before starting Flymake. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index d7cb226773..15a4d25985 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -4,7 +4,7 @@ ;; Author: Pavel Kobyakov ;; Maintainer: João Távora -;; Version: 1.0.3 +;; Version: 1.0.4 ;; Package-Requires: ((emacs "26.1")) ;; Keywords: c languages tools @@ -974,6 +974,11 @@ special *Flymake log* buffer." :group 'flymake :lighter (add-hook 'after-save-hook 'flymake-after-save-hook nil t) (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) + ;; If Flymake happened to be alrady already ON, we must cleanup + ;; existing diagnostic overlays, lest we forget them by blindly + ;; reinitializing `flymake--backend-state' in the next line. + ;; See https://github.com/joaotavora/eglot/issues/223. + (mapc #'delete-overlay (flymake--overlays)) (setq flymake--backend-state (make-hash-table)) (setq flymake--recent-changes nil)