]> git.eshelyaron.com Git - emacs.git/commitdiff
(vhdl-update-progress-info): Avoid divide by zero error.
authorJuanma Barranquero <lekktu@gmail.com>
Mon, 13 Aug 2007 11:39:45 +0000 (11:39 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Mon, 13 Aug 2007 11:39:45 +0000 (11:39 +0000)
lisp/progmodes/vhdl-mode.el

index a1bd32a313db9a75f5769dbfdb21d54e93db5409..0d909a4a3fff999f2c189272344d48cb71da3741 100644 (file)
@@ -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)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;