1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-11 16:08:13 +00:00

Don’t assume CURRENT_TIME_LIST

* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Don’t assume (current-time) returns a list.
Fix unlikely bug if we’re called 65536 seconds apart.
This commit is contained in:
Paul Eggert 2019-02-13 00:50:19 -08:00
parent 8e0d35802c
commit ae4bfd52de
3 changed files with 9 additions and 11 deletions

View File

@ -3609,7 +3609,7 @@ Otherwise reindent just the current line."
(save-excursion
(goto-char end)
(point-marker))
(nth 1 (current-time))
(encode-time nil 'integer)
context))
(message "Indenting region..."))
))
@ -3617,7 +3617,7 @@ Otherwise reindent just the current line."
(defun c-progress-update ()
(if (not (and c-progress-info c-progress-interval))
nil
(let ((now (nth 1 (current-time)))
(let ((now (encode-time nil 'integer))
(start (aref c-progress-info 0))
(end (aref c-progress-info 1))
(lastsecs (aref c-progress-info 2)))

View File

@ -8675,9 +8675,7 @@ start with default arguments, then refine the slowdown regions."
(or l (setq l 1))
(or step (setq step 500))
(or lim (setq lim 40))
(let* ((timems (function (lambda ()
(let ((tt (current-time)))
(+ (* 1000 (nth 1 tt)) (/ (nth 2 tt) 1000))))))
(let* ((timems (function (lambda () (car (encode-time nil 1000)))))
(tt (funcall timems)) (c 0) delta tot)
(goto-char (point-min))
(forward-line (1- l))

View File

@ -7392,8 +7392,8 @@ only-lines."
(defun vhdl-update-progress-info (string pos)
"Update progress information."
(when (and vhdl-progress-info (not noninteractive)
(< vhdl-progress-interval
(- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
(time-less-p vhdl-progress-interval
(time-subtract nil (aref vhdl-progress-info 2))))
(let ((delta (- (aref vhdl-progress-info 1)
(aref vhdl-progress-info 0))))
(message "%s... (%2d%%)" string
@ -7401,7 +7401,7 @@ only-lines."
100
(floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
delta))))
(aset vhdl-progress-info 2 (nth 1 (current-time)))))
(aset vhdl-progress-info 2 (encode-time nil 'integer))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Indentation commands
@ -8142,12 +8142,12 @@ depending on parameter UPPER-CASE."
(upcase-word -1)
(downcase-word -1)))
(when (and count vhdl-progress-interval (not noninteractive)
(< vhdl-progress-interval
(- (nth 1 (current-time)) last-update)))
(time-less-p vhdl-progress-interval
(time-subtract nil last-update)))
(message "Fixing case... (%2d%s)"
(+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
"%")
(setq last-update (nth 1 (current-time)))))
(setq last-update (encode-time nil 'integer))))
(goto-char end)))))
(defun vhdl-fix-case-region (beg end &optional arg)