mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
Don't overflow if computing approximate percentage
* lisp/align.el (align-region): * lisp/cedet/semantic.el (semantic-repeat-parse-whole-stream): * lisp/cedet/semantic/wisent.el (wisent-parse-region): * lisp/cus-edit.el (custom-buffer-create-internal): * lisp/emacs-lisp/checkdoc.el (checkdoc-interactive-ispell-loop) (checkdoc-message-interactive-ispell-loop, checkdoc-next-error) (checkdoc-next-message-error): * lisp/emacs-lisp/eieio-opt.el (eieio-display-method-list): * lisp/epa.el (epa-progress-callback-function): * lisp/erc/erc-dcc.el (erc-dcc-do-LIST-command): * lisp/ffap.el (ffap-menu-rescan): * lisp/gnus/nnbabyl.el (nnbabyl-retrieve-headers): * lisp/gnus/nndiary.el (nndiary-retrieve-headers): * lisp/gnus/nneething.el (nneething-retrieve-headers): * lisp/gnus/nnmbox.el (nnmbox-retrieve-headers): * lisp/gnus/nnmh.el (nnmh-retrieve-headers): * lisp/gnus/nnml.el (nnml-retrieve-headers): * lisp/gnus/nnspool.el (nnspool-retrieve-headers): * lisp/gnus/nntp.el (nntp-retrieve-headers) (nntp-retrieve-articles): * lisp/imenu.el (imenu--relative-position): * lisp/international/ja-dic-cnv.el (skkdic-collect-okuri-nasi) (skkdic-convert-okuri-nasi): * lisp/net/ange-ftp.el (ange-ftp-process-handle-hash): * lisp/nxml/rng-valid.el (rng-compute-mode-line-string): * lisp/org/org-list.el (org-update-checkbox-count): * lisp/org/org.el (org-table-map-tables) (org-update-parent-todo-statistics): * lisp/play/decipher.el (decipher-insert-frequency-counts) (decipher-analyze-buffer): * lisp/profiler.el (profiler-format-percent): * lisp/progmodes/cc-cmds.el (c-progress-update): * lisp/progmodes/cpp.el (cpp-highlight-buffer): * lisp/progmodes/idlwave.el (idlwave-convert-xml-system-routine-info) (idlwave-list-load-path-shadows): * lisp/progmodes/opascal.el (opascal-step-progress): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-scan-directory-contents): * lisp/textmodes/bibtex.el (bibtex-progress-message): * lisp/textmodes/flyspell.el (flyspell-small-region) (flyspell-external-point-words): * lisp/textmodes/table.el (table-recognize): Prefer (floor (* 100.0 NUMERATOR) DENOMINATOR) when calculating progress-report percentages and the like. This avoids problems if (* 100 NUMERATOR) would overflow. * lisp/gnus/gnus-registry.el (gnus-registry-import-eld): * lisp/gnus/registry.el (registry-reindex): Use (* 100.0 ...) rather than (* 100 ...) to avoid int overflow issues. * lisp/descr-text.el (describe-char): * lisp/org/org-colview.el (org-nofm-to-completion): * lisp/ps-print.el (ps-plot): * lisp/simple.el (what-cursor-position): Prefer (round (* 100.0 NUMERATOR) DENOMINATOR) to a more-complicated and less-accurate approximation.
This commit is contained in:
parent
0f23e95b29
commit
eb0f65b4fb
39 changed files with 74 additions and 91 deletions
|
|
@ -1437,12 +1437,12 @@ aligner would have dealt with are."
|
|||
(message
|
||||
"Aligning `%s' (rule %d of %d) %d%%..."
|
||||
(symbol-name symbol) rule-index rule-count
|
||||
(/ (* (- (point) real-beg) 100)
|
||||
(- end-mark real-beg)))
|
||||
(floor (* (- (point) real-beg) 100.0)
|
||||
(- end-mark real-beg)))
|
||||
(message
|
||||
"Aligning %d%%..."
|
||||
(/ (* (- (point) real-beg) 100)
|
||||
(- end-mark real-beg))))))
|
||||
(floor (* (- (point) real-beg) 100.0)
|
||||
(- end-mark real-beg))))))
|
||||
|
||||
;; if the search ended us on the beginning of
|
||||
;; the next line, move back to the end of the
|
||||
|
|
|
|||
|
|
@ -769,8 +769,8 @@ This function returns semantic tags without overlays."
|
|||
(eq semantic-working-type 'percent)
|
||||
(progress-reporter-update
|
||||
semantic--progress-reporter
|
||||
(/ (* 100 (semantic-lex-token-start (car stream)))
|
||||
(point-max))))))
|
||||
(floor (* 100.0 (semantic-lex-token-start (car stream)))
|
||||
(point-max))))))
|
||||
result))
|
||||
|
||||
;;; Parsing Warnings:
|
||||
|
|
|
|||
|
|
@ -322,9 +322,9 @@ the standard function `semantic-parse-region'."
|
|||
semantic--progress-reporter
|
||||
(progress-reporter-update
|
||||
semantic--progress-reporter
|
||||
(/ (* 100 (semantic-lex-token-start
|
||||
(car wisent-lex-istream)))
|
||||
(point-max))))))
|
||||
(floor (* 100.0 (semantic-lex-token-start
|
||||
(car wisent-lex-istream)))
|
||||
(point-max))))))
|
||||
;; Return parse tree
|
||||
(nreverse ptree)))
|
||||
|
||||
|
|
|
|||
|
|
@ -1709,7 +1709,7 @@ Operate on all settings in this buffer:\n"))
|
|||
(mapcar (lambda (entry)
|
||||
(prog2
|
||||
(message "Creating customization items ...%2d%%"
|
||||
(/ (* 100.0 count) length))
|
||||
(floor (* 100.0 count) length))
|
||||
(widget-create (nth 1 entry)
|
||||
:tag (custom-unlispify-tag-name
|
||||
(nth 0 entry))
|
||||
|
|
|
|||
|
|
@ -542,9 +542,7 @@ relevant to POS."
|
|||
,(let* ((beg (point-min))
|
||||
(end (point-max))
|
||||
(total (buffer-size))
|
||||
(percent (if (> total 50000) ; Avoid overflow multiplying by 100
|
||||
(/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1))
|
||||
(/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))
|
||||
(percent (round (* 100.0 (1- pos)) (max total 1)))
|
||||
(hscroll (if (= (window-hscroll) 0)
|
||||
""
|
||||
(format ", Hscroll: %d" (window-hscroll))))
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ buffer, otherwise searching starts at START-HERE."
|
|||
;; Loop over docstrings.
|
||||
(while (checkdoc-next-docstring)
|
||||
(message "Searching for doc string spell error...%d%%"
|
||||
(/ (* 100 (point)) (point-max)))
|
||||
(floor (* 100.0 (point)) (point-max)))
|
||||
(if (looking-at "\"")
|
||||
(checkdoc-ispell-docstring-engine
|
||||
(save-excursion (forward-sexp 1) (point-marker)))))
|
||||
|
|
@ -767,7 +767,7 @@ buffer, otherwise searching starts at START-HERE."
|
|||
;; Loop over message strings.
|
||||
(while (checkdoc-message-text-next-string (point-max))
|
||||
(message "Searching for message string spell error...%d%%"
|
||||
(/ (* 100 (point)) (point-max)))
|
||||
(floor (* 100.0 (point)) (point-max)))
|
||||
(if (looking-at "\"")
|
||||
(checkdoc-ispell-docstring-engine
|
||||
(save-excursion (forward-sexp 1) (point-marker)))))
|
||||
|
|
@ -791,7 +791,7 @@ perform the fix."
|
|||
(condition-case nil
|
||||
(while (and (not msg) (checkdoc-next-docstring))
|
||||
(message "Searching for doc string error...%d%%"
|
||||
(/ (* 100 (point)) (point-max)))
|
||||
(floor (* 100.0 (point)) (point-max)))
|
||||
(if (setq msg (checkdoc-this-string-valid))
|
||||
(setq msg (cons msg (point)))))
|
||||
;; Quit.. restore position, Other errors, leave alone
|
||||
|
|
@ -813,7 +813,7 @@ assumes that the cursor is already positioned to perform the fix."
|
|||
(setq type
|
||||
(checkdoc-message-text-next-string (point-max))))
|
||||
(message "Searching for message string error...%d%%"
|
||||
(/ (* 100 (point)) (point-max)))
|
||||
(floor (* 100.0 (point)) (point-max)))
|
||||
(if (setq msg (checkdoc-message-text-engine type))
|
||||
(setq msg (cons msg (point)))))
|
||||
;; Quit.. restore position, Other errors, leave alone
|
||||
|
|
|
|||
|
|
@ -243,13 +243,13 @@ are not abstract."
|
|||
(princ "Methods Primary Only: ")
|
||||
(prin1 primaryonly)
|
||||
(princ "\t")
|
||||
(princ (format "%d" (* (/ (float primaryonly) (float methidx)) 100)))
|
||||
(princ (format "%d" (floor (* 100.0 primaryonly) methidx)))
|
||||
(princ "% of total methods")
|
||||
(terpri)
|
||||
(princ "Only One Primary Impl: ")
|
||||
(prin1 oneprimary)
|
||||
(princ "\t")
|
||||
(princ (format "%d" (* (/ (float oneprimary) (float primaryonly)) 100)))
|
||||
(princ (format "%d" (floor (* 100.0 oneprimary) primaryonly)))
|
||||
(princ "% of total primary methods")
|
||||
(terpri)
|
||||
))
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ If SECRET is non-nil, list secret keys instead of public keys."
|
|||
(if (= current total)
|
||||
(message "%s...done" prompt)
|
||||
(message "%s...%d%%" prompt
|
||||
(floor (* (/ current (float total)) 100))))
|
||||
(floor (* 100.0 current) total)))
|
||||
(message "%s..." prompt))))
|
||||
|
||||
(defun epa-read-file-name (input)
|
||||
|
|
|
|||
|
|
@ -594,14 +594,9 @@ It lists the current state of `erc-dcc-list' in an easy to read manner."
|
|||
(get-buffer (plist-get elt :file))
|
||||
(+ (buffer-size) 0.0
|
||||
erc-dcc-byte-count))))
|
||||
(concat " ("
|
||||
(if (= byte-count 0)
|
||||
"0"
|
||||
(number-to-string
|
||||
(truncate
|
||||
(* 100
|
||||
(/ byte-count (plist-get elt :size))))))
|
||||
"%)"))))
|
||||
(format " (%d%%)"
|
||||
(floor (* 100.0 byte-count)
|
||||
(plist-get elt :size))))))
|
||||
?f (or (and (plist-member elt :file) (plist-get elt :file)) "")))
|
||||
(erc-display-message
|
||||
nil 'notice 'active
|
||||
|
|
|
|||
|
|
@ -1568,7 +1568,7 @@ Applies `ffap-menu-text-plist' text properties at all matches."
|
|||
(add-text-properties (car ffap-string-at-point-region) (point)
|
||||
ffap-menu-text-plist)
|
||||
(message "Scanning...%2d%% <%s>"
|
||||
(/ (* 100 (- (point) (point-min))) range) item)))
|
||||
(floor (* 100.0 (- (point) (point-min))) range) item)))
|
||||
(or mod (restore-buffer-modified-p nil))))
|
||||
(message "Scanning...done")
|
||||
;; Remove duplicates.
|
||||
|
|
|
|||
|
|
@ -1100,7 +1100,7 @@ only the last one's marks are returned."
|
|||
(when (and (< 0 expected)
|
||||
(= 0 (mod count 100)))
|
||||
(message "importing: %d of %d (%.2f%%)"
|
||||
count expected (/ (* 100 count) expected)))
|
||||
count expected (/ (* 100.0 count) expected)))
|
||||
(setq entry (car-safe old)
|
||||
old (cdr-safe old))
|
||||
(let* ((id (car-safe entry))
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
(> number nnmail-large-newsgroup)
|
||||
(zerop (% (incf count) 20))
|
||||
(nnheader-message 5 "nnbabyl: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(and (numberp nnmail-large-newsgroup)
|
||||
(> number nnmail-large-newsgroup)
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ all. This may very well take some time.")
|
|||
(> number nnmail-large-newsgroup)
|
||||
(zerop (% count 20))
|
||||
(nnheader-message 6 "nndiary: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(and (numberp nnmail-large-newsgroup)
|
||||
(> number nnmail-large-newsgroup)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ included.")
|
|||
(and large
|
||||
(zerop (% count 20))
|
||||
(nnheader-message 5 "nneething: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(when large
|
||||
(nnheader-message 5 "nneething: Receiving headers...done"))
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
(> number nnmail-large-newsgroup)
|
||||
(zerop (% count 20))
|
||||
(nnheader-message 5 "nnmbox: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(and (numberp nnmail-large-newsgroup)
|
||||
(> number nnmail-large-newsgroup)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ as unread by Gnus.")
|
|||
(and large
|
||||
(zerop (% count 20))
|
||||
(nnheader-message 5 "nnmh: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(when large
|
||||
(nnheader-message 5 "nnmh: Receiving headers...done"))
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ non-nil.")
|
|||
(> number nnmail-large-newsgroup)
|
||||
(zerop (% count 20))
|
||||
(nnheader-message 6 "nnml: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(and (numberp nnmail-large-newsgroup)
|
||||
(> number nnmail-large-newsgroup)
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ there.")
|
|||
(and do-message
|
||||
(zerop (% (incf count) 20))
|
||||
(nnheader-message 5 "nnspool: Receiving headers... %d%%"
|
||||
(/ (* count 100) number))))
|
||||
(floor (* count 100.0) number))))
|
||||
|
||||
(when do-message
|
||||
(nnheader-message 5 "nnspool: Receiving headers...done"))
|
||||
|
|
|
|||
|
|
@ -728,7 +728,7 @@ command whose response triggered the error."
|
|||
(> number nntp-large-newsgroup)
|
||||
(zerop (% received 20))
|
||||
(nnheader-message 6 "NNTP: Receiving headers... %d%%"
|
||||
(/ (* received 100) number)))
|
||||
(floor (* received 100.0) number)))
|
||||
(nntp-accept-response))))
|
||||
(and (numberp nntp-large-newsgroup)
|
||||
(> number nntp-large-newsgroup)
|
||||
|
|
@ -965,7 +965,7 @@ command whose response triggered the error."
|
|||
(> number nntp-large-newsgroup)
|
||||
(zerop (% received 20))
|
||||
(nnheader-message 6 "NNTP: Receiving articles... %d%%"
|
||||
(/ (* received 100) number)))
|
||||
(floor (* received 100.0) number)))
|
||||
(nntp-accept-response))))
|
||||
(and (numberp nntp-large-newsgroup)
|
||||
(> number nntp-large-newsgroup)
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ Errors out if the key exists already."
|
|||
(when (and (< 0 expected)
|
||||
(= 0 (mod count 1000)))
|
||||
(message "reindexing: %d of %d (%.2f%%)"
|
||||
count expected (/ (* 100 count) expected)))
|
||||
count expected (/ (* 100.0 count) expected)))
|
||||
(dolist (val (cdr-safe (assq tr v)))
|
||||
(let* ((value-keys (registry-lookup-secondary-value db tr val)))
|
||||
(push key value-keys)
|
||||
|
|
|
|||
|
|
@ -499,10 +499,7 @@ If REVERSE is non-nil then the beginning is 100 and the end is 0."
|
|||
(let ((pos (point))
|
||||
(total (buffer-size)))
|
||||
(and reverse (setq pos (- total pos)))
|
||||
(if (> total 50000)
|
||||
;; Avoid overflow from multiplying by 100!
|
||||
(/ (1- pos) (max (/ total 100) 1))
|
||||
(/ (* 100 (1- pos)) (max total 1)))))
|
||||
(floor (* 100.0 (1- pos)) (max total 1))))
|
||||
|
||||
(defun imenu--split (list n)
|
||||
"Split LIST into sublists of max length N.
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@
|
|||
(cons (cons kana candidates) skkdic-okuri-nasi-entries)
|
||||
skkdic-okuri-nasi-entries-count
|
||||
(1+ skkdic-okuri-nasi-entries-count))
|
||||
(setq ratio (floor (/ (* (point) 100.0) (point-max))))
|
||||
(setq ratio (floor (* (point) 100.0) (point-max)))
|
||||
(if (/= (/ prev-ratio 10) (/ ratio 10))
|
||||
(progn
|
||||
(message "collected %2d%% ..." ratio)
|
||||
|
|
@ -306,7 +306,7 @@
|
|||
(while l
|
||||
(let ((kana (car (car l)))
|
||||
(candidates (cdr (car l))))
|
||||
(setq ratio (/ (* count 100) skkdic-okuri-nasi-entries-count)
|
||||
(setq ratio (floor (* count 100.0) skkdic-okuri-nasi-entries-count)
|
||||
count (1+ count))
|
||||
(if (/= (/ prev-ratio 10) (/ ratio 10))
|
||||
(progn
|
||||
|
|
|
|||
|
|
@ -1613,7 +1613,7 @@ good, skip, fatal, or unknown."
|
|||
-6)))
|
||||
(if (zerop ange-ftp-xfer-size)
|
||||
(ange-ftp-message "%s...%dk" ange-ftp-process-msg kbytes)
|
||||
(let ((percent (/ (* 100 kbytes) ange-ftp-xfer-size)))
|
||||
(let ((percent (floor (* 100.0 kbytes) ange-ftp-xfer-size)))
|
||||
;; cut out the redisplay of identical %-age messages.
|
||||
(unless (eq percent ange-ftp-last-percent)
|
||||
(setq ange-ftp-last-percent percent)
|
||||
|
|
|
|||
|
|
@ -345,17 +345,11 @@ The schema is set like `rng-auto-set-schema'."
|
|||
|
||||
(defun rng-compute-mode-line-string ()
|
||||
(cond (rng-validate-timer
|
||||
(concat " Validated:"
|
||||
(number-to-string
|
||||
;; Use floor rather than round because we want
|
||||
;; to show 99% rather than 100% for changes near
|
||||
;; the end.
|
||||
(floor (if (eq (buffer-size) 0)
|
||||
0.0
|
||||
(/ (* (- rng-validate-up-to-date-end (point-min))
|
||||
100.0)
|
||||
(- (point-max) (point-min))))))
|
||||
"%%"))
|
||||
(format " Validated:%d%%"
|
||||
(if (= 0 (buffer-size))
|
||||
0
|
||||
(floor (- rng-validate-up-to-date-end (point-min))
|
||||
(- (point-max) (point-min))))))
|
||||
((> rng-error-count 0)
|
||||
(concat " "
|
||||
(propertize "Invalid"
|
||||
|
|
|
|||
|
|
@ -1086,7 +1086,7 @@ display, or in the #+COLUMNS line of the current buffer."
|
|||
(defun org-nofm-to-completion (n m &optional percent)
|
||||
(if (not percent)
|
||||
(format "[%d/%d]" n m)
|
||||
(format "[%d%%]"(floor (+ 0.5 (* 100. (/ (* 1.0 n) m)))))))
|
||||
(format "[%d%%]" (round (* 100.0 n) m))))
|
||||
|
||||
|
||||
(defun org-columns-string-to-number (s fmt)
|
||||
|
|
|
|||
|
|
@ -2555,8 +2555,8 @@ With optional prefix argument ALL, do this for the whole buffer."
|
|||
(checked (car (nth 3 cookie)))
|
||||
(total (cdr (nth 3 cookie)))
|
||||
(new (if percentp
|
||||
(format "[%d%%]" (/ (* 100 checked)
|
||||
(max 1 total)))
|
||||
(format "[%d%%]" (floor (* 100.0 checked)
|
||||
(max 1 total)))
|
||||
(format "[%d/%d]" checked total))))
|
||||
(goto-char beg)
|
||||
(insert new)
|
||||
|
|
|
|||
|
|
@ -4346,7 +4346,8 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
|
|||
(goto-char (point-min))
|
||||
(while (re-search-forward org-table-any-line-regexp nil t)
|
||||
(unless quietly
|
||||
(message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))))
|
||||
(message "Mapping tables: %d%%"
|
||||
(floor (* 100.0 (point)) (buffer-size))))
|
||||
(beginning-of-line 1)
|
||||
(when (and (looking-at org-table-line-regexp)
|
||||
;; Exclude tables in src/example/verbatim/clocktable blocks
|
||||
|
|
@ -12679,7 +12680,8 @@ statistics everywhere."
|
|||
(outline-next-heading)))
|
||||
(setq new
|
||||
(if is-percent
|
||||
(format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
|
||||
(format "[%d%%]" (floor (* 100.0 cnt-done)
|
||||
(max 1 cnt-all)))
|
||||
(format "[%d/%d]" cnt-done cnt-all))
|
||||
ndel (- (match-end 0) checkbox-beg))
|
||||
;; handle overlays when updating cookie from column view
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ TOTAL is the total number of letters in the ciphertext."
|
|||
(insert (caar temp-list)
|
||||
(format "%4d%3d%% "
|
||||
(cl-cadar temp-list)
|
||||
(/ (* 100 (cl-cadar temp-list)) total)))
|
||||
(floor (* 100.0 (cl-cadar temp-list)) total)))
|
||||
(setq temp-list (nthcdr 4 temp-list)))
|
||||
(insert ?\n)
|
||||
(setq freq-list (cdr freq-list)
|
||||
|
|
@ -957,7 +957,7 @@ Creates the statistics buffer if it doesn't exist."
|
|||
": A B C D E F G H I J K L M N O P Q R S T U V W X Y Z *"
|
||||
(format "%4d %4d %3d%%\n "
|
||||
(cl-third entry) (cl-second entry)
|
||||
(/ (* 100 (cl-second entry)) total-chars))
|
||||
(floor (* 100.0 (cl-second entry)) total-chars))
|
||||
(decipher--digram-counts (aref decipher--after i)) ?\n))))
|
||||
(setq buffer-read-only t)
|
||||
(set-buffer-modified-p nil)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
(format "%s" object))))
|
||||
|
||||
(defun profiler-format-percent (number divisor)
|
||||
(concat (number-to-string (/ (* number 100) divisor)) "%"))
|
||||
(format "%d%%" (floor (* 100.0 number) divisor)))
|
||||
|
||||
(defun profiler-format-number (number)
|
||||
"Format NUMBER in human readable string."
|
||||
|
|
|
|||
|
|
@ -1809,7 +1809,7 @@ with a brace block."
|
|||
(c-save-buffer-state
|
||||
(beginning-of-defun-function end-of-defun-function
|
||||
where pos name-end case-fold-search)
|
||||
|
||||
|
||||
(save-restriction
|
||||
(widen)
|
||||
(save-excursion
|
||||
|
|
@ -3412,7 +3412,7 @@ Otherwise reindent just the current line."
|
|||
(if (< c-progress-interval (- now lastsecs))
|
||||
(progn
|
||||
(message "Indenting region... (%d%% complete)"
|
||||
(/ (* 100 (- (point) start)) (- end start)))
|
||||
(floor (* 100.0 (- (point) start)) (- end start)))
|
||||
(aset c-progress-info 2 now)))
|
||||
)))
|
||||
|
||||
|
|
|
|||
|
|
@ -234,7 +234,8 @@ A prefix arg suppresses display of that buffer."
|
|||
(cpp-progress-message "Parsing...")
|
||||
(while (re-search-forward cpp-parse-regexp nil t)
|
||||
(cpp-progress-message "Parsing...%d%%"
|
||||
(/ (* 100 (- (point) (point-min))) (buffer-size)))
|
||||
(floor (* 100.0 (- (point) (point-min)))
|
||||
(buffer-size)))
|
||||
(let ((match (buffer-substring (match-beginning 0) (match-end 0))))
|
||||
(cond ((or (string-equal match "'")
|
||||
(string-equal match "\""))
|
||||
|
|
|
|||
|
|
@ -4881,7 +4881,7 @@ Cache to disk for quick recovery."
|
|||
props (car (cdr elem)))
|
||||
(if (= (mod elem-cnt msg-cnt) 0)
|
||||
(message "Converting XML routine info...%2d%%"
|
||||
(/ (* elem-cnt 100) nelem)))
|
||||
(floor (* elem-cnt 100.0) nelem)))
|
||||
(cond
|
||||
((eq type 'ROUTINE)
|
||||
(if (setq alias (assq 'alias_to props))
|
||||
|
|
@ -8694,7 +8694,7 @@ can be used to detect possible name clashes during this process."
|
|||
(erase-buffer)
|
||||
(while (setq routine (pop routines))
|
||||
(if (= (mod (setq n (1+ n)) step) 0)
|
||||
(message "Compiling list...(%2d%%)" (/ (* n 100) nroutines)))
|
||||
(message "Compiling list...(%2d%%)" (floor (* n 100.0) nroutines)))
|
||||
|
||||
;; Get a list of all twins
|
||||
(setq twins (idlwave-routine-twins routine (or lroutines routines)))
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ routine.")
|
|||
;; Report the percentage complete.
|
||||
(setq opascal-progress-last-reported-point p)
|
||||
(message "%s %s ... %d%%"
|
||||
desc (buffer-name) (/ (* 100 p) (point-max))))))
|
||||
desc (buffer-name) (floor (* 100.0 p) (point-max))))))
|
||||
|
||||
(defun opascal-next-line-start (&optional from-point)
|
||||
;; Returns the first point of the next line.
|
||||
|
|
|
|||
|
|
@ -7383,11 +7383,11 @@ only-lines."
|
|||
(- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
|
||||
(let ((delta (- (aref vhdl-progress-info 1)
|
||||
(aref vhdl-progress-info 0))))
|
||||
(if (= 0 delta)
|
||||
(message (concat string "... (100%s)") "%")
|
||||
(message (concat string "... (%2d%s)")
|
||||
(/ (* 100 (- pos (aref vhdl-progress-info 0)))
|
||||
delta) "%")))
|
||||
(message "%s... (%2d%%)" string
|
||||
(if (= 0 delta)
|
||||
100
|
||||
(floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
|
||||
delta))))
|
||||
(aset vhdl-progress-info 2 (nth 1 (current-time)))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
@ -13881,10 +13881,10 @@ hierarchy otherwise.")
|
|||
;; do for all files
|
||||
(while file-list
|
||||
(unless noninteractive
|
||||
(message "Scanning %s %s\"%s\"... (%2d%s)"
|
||||
(message "Scanning %s %s\"%s\"... (%2d%%)"
|
||||
(if is-directory "directory" "files")
|
||||
(or num-string "") name
|
||||
(/ (* 100 (- no-files (length file-list))) no-files) "%"))
|
||||
(floor (* 100.0 (- no-files (length file-list))) no-files)))
|
||||
(let ((file-name (abbreviate-file-name (car file-list)))
|
||||
ent-list arch-list arch-ent-list conf-list
|
||||
pack-list pack-body-list inst-list inst-ent-list)
|
||||
|
|
|
|||
|
|
@ -6043,10 +6043,7 @@ XSTART YSTART are the relative position for the first page in a sheet.")
|
|||
(progn
|
||||
(setq ps-razchunk q-done)
|
||||
(message "Formatting...%3d%%"
|
||||
(if (< q-todo 100)
|
||||
(/ (* 100 q-done) q-todo)
|
||||
(/ q-done (/ q-todo 100)))
|
||||
))))))
|
||||
(floor (* 100.0 q-done) q-todo)))))))
|
||||
|
||||
(defvar ps-last-font nil)
|
||||
|
||||
|
|
|
|||
|
|
@ -1255,10 +1255,7 @@ in *Help* buffer. See also the command `describe-char'."
|
|||
(end (point-max))
|
||||
(pos (point))
|
||||
(total (buffer-size))
|
||||
(percent (if (> total 50000)
|
||||
;; Avoid overflow from multiplying by 100!
|
||||
(/ (+ (/ total 200) (1- pos)) (max (/ total 100) 1))
|
||||
(/ (+ (/ total 2) (* 100 (1- pos))) (max total 1))))
|
||||
(percent (round (* 100.0 (1- pos)) (max 1 total)))
|
||||
(hscroll (if (= (window-hscroll) 0)
|
||||
""
|
||||
(format " Hscroll=%d" (window-hscroll))))
|
||||
|
|
|
|||
|
|
@ -2099,7 +2099,7 @@ If FLAG is nil, a message is echoed if point was incremented at least
|
|||
(let* ((size (- (point-max) (point-min)))
|
||||
(perc (if (= size 0)
|
||||
100
|
||||
(/ (* 100 (- (point) (point-min))) size))))
|
||||
(floor (* 100.0 (- (point) (point-min))) size))))
|
||||
(when (>= perc (+ bibtex-progress-lastperc
|
||||
bibtex-progress-interval))
|
||||
(setq bibtex-progress-lastperc perc)
|
||||
|
|
|
|||
|
|
@ -1350,7 +1350,7 @@ that may be included as part of a word (see `ispell-dictionary-alist')."
|
|||
(if (and flyspell-issue-message-flag (= count 100))
|
||||
(progn
|
||||
(message "Spell Checking...%d%%"
|
||||
(* 100 (/ (float (- (point) beg)) (- end beg))))
|
||||
(floor (* 100.0 (- (point) beg)) (- end beg)))
|
||||
(setq count 0))
|
||||
(setq count (+ 1 count)))
|
||||
(flyspell-word)
|
||||
|
|
@ -1403,7 +1403,7 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
|
|||
;; be unnecessary too. -- rms.
|
||||
(if flyspell-issue-message-flag
|
||||
(message "Spell Checking...%d%% [%s]"
|
||||
(* 100 (/ (float (point)) (point-max)))
|
||||
(floor (* 100.0 (point)) (point-max))
|
||||
word))
|
||||
(with-current-buffer flyspell-large-region-buffer
|
||||
(goto-char buffer-scan-pos)
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,9 @@ all the table specific features."
|
|||
(while (and (re-search-forward border3 (point-max) t)
|
||||
(not (and (input-pending-p)
|
||||
table-abort-recognition-when-input-pending)))
|
||||
(message "Recognizing tables...(%d%%)" (/ (* 100 (match-beginning 0)) (- (point-max) (point-min))))
|
||||
(message "Recognizing tables...(%d%%)"
|
||||
(floor (* 100.0 (match-beginning 0))
|
||||
(- (point-max) (point-min))))
|
||||
(let ((beg (match-beginning 0))
|
||||
end)
|
||||
(if (re-search-forward non-border (point-max) t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue