0

By default I have set truncate-lines to t, (do not display continuation lines), hence I want to enable it for csv-mode by default.

Code section related to truncate-lines in my config file.

(add-hook 'minibuffer-setup-hook
          (lambda () (setq truncate-lines nil)))
(setq-default truncate-lines t)
(global-set-key (kbd "C-x C-t") 'toggle-truncate-lines)

I have tried to add following lines, which did not work:

(defun my-truncate-lines-disables ()
  (setq truncate-lines nil))
(add-hook 'csv-mode-hook 'my-truncate-lines-disables)

Related: How to prevent line wrapping in code, but allow it in help/info buffers?

alper
  • 1,238
  • 11
  • 30
  • What version of emacs are you using? What does `C-h f csv-mode` say? What does `C-h v csv-mode-hook` say? BTW, although this has nothing to do with the problem you see, the function is named misleadingly: it `disables` truncation of lines. – NickD Jun 09 '23 at 12:30
  • `csv-mode c () Major mode for editing files of comma-separated value type.` | `csv-mode-hook v nil Hook run after entering CSV mode.`. I have updated the function name. – alper Jun 09 '23 at 12:38
  • It should work then. It works fine here. – NickD Jun 09 '23 at 12:55
  • What happens when you run `M-x toggle-truncate-lines` two times? do you have a better view for a long line csv file? I can see its real affect first disabling Truncate long and than re-enable Truncate long lines – alper Jun 09 '23 at 14:18
  • It goes to truncated lines and then back again, just as expected. I don't understand what you are asking: what's a "better" view? They are two different views. – NickD Jun 09 '23 at 15:58
  • At first truncated lines does not look as it should be for a very long line. But after I do truncated lines and then back again it corrects the look it has, having continues lines. Better view has csv-mode align columns. – alper Jun 09 '23 at 16:06

0 Answers0