Josh writes: > The align-region function assumes that a matching regexp does not > contain a newline. This causes unexpected behavior in cases where the > first "column" being aligned contains only whitespace. The following > script exhibits the unexpected behavior: > > emacs -Q --eval '(progn > (switch-to-buffer "*test*") > (text-mode) > (setq indent-tabs-mode nil) > (insert "lorem ipsum, dolor sit amet,\n ,,\n") > (let ((table (make-syntax-table (syntax-table)))) > ;; (modify-syntax-entry ?\n ">" table) ; <= UNCOMMENT THIS LINE TO FIX > (with-syntax-table table > (align-regexp (point-min) (point-max) "\\(\\s-*\\)," 1 1 t))))' > > Uncommenting the seventh line and running again will show the expected > behavior. The fix works around the problem by using a syntax map in > which the newline character does not belong to the whitespace syntax > class, thus preventing \s-* from matching the newline. (This bug report unfortunately got no response at the time.) You don't specify what the result is you're seeing, and what you expect to see, so I'm not sure whether this is fixed or not. When I try your recipe in Emacs 26.1-28, I get: