These spaces were typically inserted earlier by comment-region. This patch
makes these two complementary functions closer to inverses.
* lisp/newcomment.el (uncomment-region-default-1): Remove spaces before a tab
where the comment opener has just been removed.
(re-search-forward sre (line-end-position) t))
(replace-match "" t t nil (if (match-end 2) 2 1)))))
;; Go to the end for the next comment.
- (goto-char (point-max))))))
+ (goto-char (point-max)))
+ ;; Remove any obtrusive spaces left preceding a tab at `spt'.
+ (when (and (eq (char-after spt) ?\t) (eq (char-before spt) ? )
+ (> tab-width 0))
+ (save-excursion
+ (goto-char spt)
+ (let* ((fcol (current-column))
+ (slim (- (point) (mod fcol tab-width))))
+ (delete-char (- (skip-chars-backward " " slim)))))))))
(set-marker end nil))
(defun uncomment-region-default (beg end &optional arg)