tags:

views:

570

answers:

2

Hi,

I recently discovered longlines mode in Emacs (after having been a regular user for 5 yrs!). So I set in my .emacs file

(add-hook 'text-mode-hook 'turn-on-auto-fill) 
(add-hook 'text-mode-hook 'longlines-mode)

(do I still need auto-fill? I can't tell...) which also sets org-mode to operate in longlines-mode as well. This seems to mess up the table construction functionality so I'd like to disable longlines mode for org-mode (which appears to incorporate text-mode-hooks) but keep it enabled for text (.txt) files.

I wonder if anyone has a solution to this? I am slowly picking up bits of Emacs Lisp but have not studied up on manipulating mode-hooks yet...

Thanks much! -Stephen

+4  A: 

Try visual-line-mode, which supplants longlines-mode since Emacs-23.1.

huaiyuan
Yes, I just switched to Emacs 23, so this works well - thank you.
Stephen
Thanks very much for this answer. I wish they'd just nuke obsolete libraries like longlines-mode so that they're no longer accidentally available. :-)
ShreevatsaR
+3  A: 

You should be able to explicitly disable longlines-mode in org-mode by adding a hook to org-mode-hook:

(add-hook 'org-mode-hook
          '(lambda ()
             (longlines-mode -1)))

Edit: Thanks to Török Gábor for pointing out my elisp fail :-)

Sean Bright
This toggles it off when it's on? Interesting... and thanks!
Stephen
It should yes. Basically it toggles `longlines-mode` until it returns `nil`, which means it is off. I couldn't see another way to deterministically turn it off.
Sean Bright
Kludgey (pardon my saying so) but clever! Very much so...
Stephen
Why not use form `(longlines-mode -1)` as usual?
Török Gábor
That does indeed work, not sure where my head was. Thanks.
Sean Bright