The attached patch attempts to speed up the 'csv-align-fields' command by avoiding expensive calls to 'current-column', instead reusing field widths already computed by 'csv--column-widths'. I felt an urge to speed up the command a bit while working with large (100 000+ lines) CSV files. Below are benchmarks produced by running (benchmark 3 '(csv-align-fields nil (point-min) (point-max))) in three CSV files from the real world of various sizes. In these cases the speedup seems to be around 1.5x—2x. ~400 line file: Before: Elapsed time: 0.175867s After: Elapsed time: 0.086809s ~50 000 line file: Before: Elapsed time: 34.665853s (7.480686s in 35 GCs) After: Elapsed time: 24.349081s (7.154716s in 27 GCs) ~110 000 line file: Before: Elapsed time: 82.444038s (19.799686s in 51 GCs) After: Elapsed time: 40.184331s (9.037813s in 25 GCs) (I've put on CC the two of you who seem to have done most of the work on this mode lately, hope that's OK.) -- Simen