I want to set the variable truncate-lines to t in order to have truncated lines, but only in programming modes. So, following this thread, I put the following code in my configuration file:
(defun my-prog-mode-hook ()
(setq truncate-lines t))
(add-hook 'prog-mode-hook #'my-prog-mode-hook)
My problem is this does not work, because truncate-lines is still nil when I start Emacs in fortran-mode (for example). The lambda version of the above code gives the same result.
What am I missing?