From: Juanma Barranquero Date: Mon, 13 Aug 2007 11:12:50 +0000 (+0000) Subject: (vhdl-update-progress-info): Avoid divide by zero error. X-Git-Tag: emacs-pretest-23.0.90~11520 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b0cf7916dcc9887d01ab0e7e698a5e8fc5a80016;p=emacs.git (vhdl-update-progress-info): Avoid divide by zero error. --- diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index a1bd32a313d..0d909a4a3ff 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -6982,10 +6982,13 @@ only-lines." (when (and vhdl-progress-info (not noninteractive) (< vhdl-progress-interval (- (nth 1 (current-time)) (aref vhdl-progress-info 2)))) - (message (concat string "... (%2d%s)") - (/ (* 100 (- pos (aref vhdl-progress-info 0))) - (- (aref vhdl-progress-info 1) - (aref vhdl-progress-info 0))) "%") + (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) "%"))) (aset vhdl-progress-info 2 (nth 1 (current-time))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;