From c3c077170aefa8ba0cd5d8f8b824c85eb0f01a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Sun, 15 Sep 2019 17:31:40 +0200 Subject: [PATCH] WIP --- packages/csv-mode/csv-mode.el | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/csv-mode/csv-mode.el b/packages/csv-mode/csv-mode.el index dc2555687..00107f51e 100644 --- a/packages/csv-mode/csv-mode.el +++ b/packages/csv-mode/csv-mode.el @@ -976,18 +976,26 @@ The fields yanked are those last killed by `csv-kill-fields'." (while (not (eobp)) ; for each record... (or (csv-not-looking-at-record) (let ((w column-widths) - (col (current-column)) + (col-beg (current-column)) + col-end field-width) (while (not (eolp)) (csv-end-of-field) - (setq field-width (- (current-column) col)) + (setq col-end (current-column)) + (setq field-width (- col-end col-beg)) (push field-width field-widths) (if w (if (> field-width (car w)) (setcar w field-width)) (setq w (list field-width) column-widths (nconc column-widths w))) - (or (eolp) (forward-char)) ; Skip separator. - (setq w (cdr w) col (current-column))))) + (unless (eolp) + (forward-char) ; Skip separator. + (setq w (cdr w)) + (setq col-beg (if (= (char-before) ?\t) + (* (/ (+ col-end tab-width) + tab-width) + tab-width) + (+ col-end (char-width (char-before))))))))) (forward-line)) (list column-widths (nreverse field-widths)))) -- 2.23.0