comparison lisp/indent.el @ 17155:d8e2f7cfb2b7

(indent-line-to): Fix off-by-one bug when deciding whether to delete the existing spaces.
author Karl Heuer <kwzh@gnu.org>
date Fri, 14 Mar 1997 16:35:03 +0000
parents 8db176b73c9f
children 681823a203b6
comparison
equal deleted inserted replaced
17154:01faa9b0043e 17155:d8e2f7cfb2b7
82 This function removes or adds spaces and tabs at beginning of line 82 This function removes or adds spaces and tabs at beginning of line
83 only if necessary. It leaves point at end of indentation." 83 only if necessary. It leaves point at end of indentation."
84 (back-to-indentation) 84 (back-to-indentation)
85 (let ((cur-col (current-column))) 85 (let ((cur-col (current-column)))
86 (cond ((< cur-col column) 86 (cond ((< cur-col column)
87 (if (> (- column (* (/ cur-col tab-width) tab-width)) tab-width) 87 (if (>= (- column (* (/ cur-col tab-width) tab-width)) tab-width)
88 (delete-region (point) 88 (delete-region (point)
89 (progn (skip-chars-backward " ") (point)))) 89 (progn (skip-chars-backward " ") (point))))
90 (indent-to column)) 90 (indent-to column))
91 ((> cur-col column) ; too far right (after tab?) 91 ((> cur-col column) ; too far right (after tab?)
92 (delete-region (progn (move-to-column column t) (point)) 92 (delete-region (progn (move-to-column column t) (point))