- (save-excursion
- (save-restriction
- (narrow-to-region (point-min) end)
- (goto-char start)
- (while (search-forward "\t" nil t) ; faster than re-search
- (forward-char -1)
- (let ((tab-beg (point))
- (indent-tabs-mode nil)
- column)
- (skip-chars-forward "\t")
- (setq column (current-column))
- (delete-region tab-beg (point))
- (indent-to column))))))
+ (let ((c (current-column)))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region (point-min) end)
+ (goto-char start)
+ (while (search-forward "\t" nil t) ; faster than re-search
+ (forward-char -1)
+ (let ((tab-beg (point))
+ (indent-tabs-mode nil)
+ column)
+ (skip-chars-forward "\t")
+ (setq column (current-column))
+ (delete-region tab-beg (point))
+ (indent-to column)))))
+ (move-to-column c)))