Jojje
Jojje

Reputation: 1779

unwanted formatting / line breaks in emacs

I'm experiencing problems in Emacs when I edit web template code, i.e mixed php/html code or mixed ruby/html code. Emacs makes line breaks when it should not. The line breaks occurs when I enter a space somewhere on the line, very annoying...

How can I disable this behaviour?

Below is the kind of code I'm working with. If I would enter a space after one of the commas there, then Emacs will make a line break, sometimes multiple line breaks.

<% if @item.id %>
 <b>Congratulations!The item was saved!
 <%= button_to 'Preview the ad',@item,:method=>:get,:class => "btn add" %>
<% end %>

thanks!

Upvotes: 2

Views: 330

Answers (2)

PascalVKooten
PascalVKooten

Reputation: 21443

To save this process for further sessions, you can put in your .emacs (after where it loads the mode specific stuff):

(auto-fill-mode nil)

Another thing is that you could embrace this feature; it is often good to have a limit on the amount of code you want to have in your screen.

Use M-x set-fill-column RET to set the amount of characters allowed on a line before it automatically breaks the line.

Upvotes: 2

It looks like for some reason auto-fill-mode is active (which you can check by looking for "Fill" in your modeline). If this is the case, you should turn it off:

M-xauto-fill-modeRET

Upvotes: 3

Related Questions