Subject: 23.2; indent-line-to possible devide by zero error bug

From: Arik Mitschang <[email-masked]>
Date: Tue, 24 Aug 2010 11:27:47 -0400

In indent.el the indent-line-to function has a comparison that devides
the current column count by tab-width, whose value is an integerp and
allowed to be zero (and in my experience is often 0). I noticed the
issue in specific with org mode which utilizes this function for a lot
of interesting tasks.

I can provide the following patch which makes a check to avoid an
arithmetic error:

=== modified file 'lisp/indent.el'
--- lisp/indent.el	2010-05-19 03:06:48 +0000
+++ lisp/indent.el	2010-08-24 15:20:39 +0000
@@ -177,7 +177,9 @@
   (back-to-indentation)
   (let ((cur-col (current-column)))
     (cond ((< cur-col column)
-	   (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
+	   (if (and (> tab-width 0)
+		    (>= (- column (* (/ cur-col tab-width) tab-width)) 
+			tab-width))
 	       (delete-region (point)
 			      (progn (skip-chars-backward " ") (point))))
 	   (indent-to column))

Thanks,
~Arik