17

I have been using csv-mode to modify small to medium sized CSV files, but recently I have been working with large files containing more than 40,812 entries. csv-mode struggles to align and navigate the tables, and is too slow to be usable as is. In comparison, LibreOffice Calc can zip through the file.

Is there a simple way to make csv-mode handle large tables, or is there a better approach available?

I am aware of a related Stack Overflow question. Its solution was to only align the portion of buffer in the visible window, but this did not solve the sluggishness in my case.

Here is an example file. I tried to make it large, but not so large it will freeze Emacs on older computers.

4
  • 3
    Table editing is not one of Emacs's current strengths. I wish it was. I'd rather never have to use a dedicated spreadsheet.
    – wdkrnls
    Oct 9, 2014 at 22:13
  • 2
    Not a short-term answer, but you might want to M-x report-emacs-bug about it, ideally with a recipe to reproduce the slow-down. There's probably a lot of room for improvement in csv-mode.
    – Stefan
    Oct 14, 2014 at 16:47
  • 3
    Do you have a sample file that demonstrates the problem? Oct 15, 2014 at 7:55
  • Yes, yes I do. Added to question. Oct 30, 2014 at 23:52

1 Answer 1

13

With csv-mode I can see some lags with your file, but only with syntax highlighting enabled. After disabling fontification with M-x font-lock-mode it works without problems.

To disable it permanently for csv-mode add to your config:

(add-hook 'csv-mode-hook (lambda () (font-lock-mode -1))

Or if you are a use-package user:

(use-package csv-mode
  :mode ("\\.csv\\'" . csv-mode)
  :init (add-hook 'csv-mode-hook (lambda () (font-lock-mode -1)))
  :ensure t)
2
  • 2
    After disabling font-lock-mode, company-mode, and a couple other minor modes, speed improved considerably! I consider this a major success. Oct 31, 2014 at 22:40
  • 5
    I would even consider wrapping this to only apply to large files: (when (> (point-max) some-large-number) (font-lock-mode -1)) Nov 1, 2014 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.