Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable auto fill mode in noweb-mode

Tags:

emacs

autofill

Please for the love of god how can I make Emacs stop auto-filling? I use visual-line-mode, I do not want auto fill. I can turn it off with M-x auto-fill-mode RET but in Noweb mode it gets turned back on when I move into a code chunk and back out again. Please, I just want to globally turn of auto fill mode, it's driving me crazy.

I've tried

(auto-fill-mode 0)

and a bunch of crazy things like

(add-hook 'Rnw-mode-hook '(lambda () (auto-fill-mode 0)))
(add-hook 'latex-mode-hook '(lambda () (auto-fill-mode 0)))

But nothing seems to work. Please help me.

like image 254
Ista Avatar asked Oct 14 '09 15:10

Ista


3 Answers

Instead of adding further hooks to your system, you should check if you could remove some to disable auto-fill.

If you see noweb-mode's source code, around line 211 you find this chunk:

(add-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(add-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)

To disable auto filling, put the following one or two lines in your dotemacs (depending on whether you want to disable auto-fill in both code and documentation).

(remove-hook 'noweb-select-doc-mode-hook 'noweb-auto-fill-doc-mode)
(remove-hook 'noweb-select-code-mode-hook 'noweb-auto-fill-code-mode)
like image 109
viam0Zah Avatar answered Nov 03 '22 15:11

viam0Zah


OK, I worked out a hack that does the trick:

(setq auto-fill-mode -1)
(setq-default fill-column 99999)
(setq fill-column 99999)

If I can't turn off auto-fill mode, at least I can make it harmless by setting it to fill only in column 99999. I'll be annoyed if I type a paragraph with more than 99999 characters, but if that happens I'll have bigger things to worry about...

like image 4
Ista Avatar answered Nov 03 '22 15:11

Ista


If you look at simple.el, at the very top text-mode-hook is defined, which is ultimately responsible for turning on this abomination (or at least, it was for me).

To get to simple.el and look for yourself: (C-h f, auto-fill-mode, click / follow simple.el link)

To disable, M-x customize-variable text-mode-hook

Screen shot

Uncheck turn-on-auto-fill. Be sure to click "Save for future sessions" at the top.

like image 3
Tim Harper Avatar answered Nov 03 '22 15:11

Tim Harper