0

I have following setting in ~/.emacs

(defun my-fillcol-hook ()
   (longlines-mode t)
   (setq-default fill-column 80))                                                                                                                                                                                 

(add-hook 'c-mode-hook 'my-fillcol-hook)
(add-hook 'c++-mode-hook 'my-fillcol-hook)
(add-hook 'tuareg-mode-hook 'my-fillcol-hook)

The fill-column is set as expected in C-mode and C++-mode but not in tuareg-mode. I am not able to find out why fill-column is not getting set in tuareg-mode. Thanks in advance for the help.

Thomash
  • 6,339
  • 1
  • 30
  • 50
UnSat
  • 1,347
  • 2
  • 14
  • 28
  • possible duplicate of [How do I set the Emacs fill-column for a specific mode?](http://stackoverflow.com/questions/8080495/how-do-i-set-the-emacs-fill-column-for-a-specific-mode) – Dan Aug 09 '14 at 21:03
  • See the above thread for a way to set the `fill-column`. FWIW, `setq-default` should go *outside* of a mode hook, with a regular `setq` inside the mode hook. If you did the former, you would essentially be resetting the default value every time you entered a buffer of that particular mode. – Dan Aug 09 '14 at 21:09

1 Answers1

0

setq-default changes the global value, whereas tuareg-mode apparently sets a buffer-local value which takes precedence. IOW you want to use setq-local or just setq.

Stefan
  • 27,908
  • 4
  • 53
  • 82