[comp.emacs] Word Wrap in Gnu Emacs

jr@bbn.com (John Robinson) (01/13/89)

In article <129@ai.cs.utexas.edu>, yvo@cs (Yvonne van Olphen) writes:
>
>I figured out how to set word wrap in emacs:
>
>	M-x auto-fill-mode
>
>My problem is, what do I put in my .emacs_pro file to
>make this mode load automatically?  I looked in the manual
>and tried a couple of things, but nothing worked.

Here's what I do:

First of all, I set the default mode (what is used when there is no
file-name-dependent mode to invoke) to be text-mode, by setting the
emacs default mode:

  (setq default-major-mode 'text-mode)

After text-mode is invoked, it runs its "hook", a lisp form that is
evaluated (or a list of such forms) to allow for your own
customizations.  I get text-mode to also come up in auto-fill thus:

  (setq text-mode-hook 'turn-on-auto-fill)

Cheers,
--
/jr
jr@bbn.com or bbn!jr

hollen@spot.megatek.uucp (Dion Hollenbeck) (01/13/89)

From article <129@ai.cs.utexas.edu>, by yvo@cs.utexas.edu (Yvonne van Olphen):
> 
> I figured out how to set word wrap in emacs:
> 
> 	M-x auto-fill-mode
> 
> My problem is, what do I put in my .emacs_pro file to
> make this mode load automatically?  I looked in the manual
> and tried a couple of things, but nothing worked.
> 
> 	-Yvonne

This is right out of the INFO facility of emacs under the menu items
"emacs, init, examples" (this puts you three levels down):

   * Turn on Auto Fill mode automatically in Text mode and related modes.
     
          (setq text-mode-hook
            '(lambda () (auto-fill-mode 1)))


Just add the above lines (less comment line) and this should work for you.
By the way, do you know about the INFO facility ( \C-h i )?  Lots of people
would just say RTFM, but lots of times, people need to have a pointer to 
the fact that there is a manual at all (and the INFO facility is a really
great one).

Hope this helps you out.

	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121

                                seismo!s3sun!megatek!hollen
                                ames!scubed/

jr@bbn.com (John Robinson) (01/14/89)

In article <458@megatek.UUCP>, hollen@spot (Dion Hollenbeck) writes:
>This is right out of the INFO facility of emacs under the menu items
>"emacs, init, examples" (this puts you three levels down):
>
>   * Turn on Auto Fill mode automatically in Text mode and related modes.
>     
>          (setq text-mode-hook
>            '(lambda () (auto-fill-mode 1)))
>
>
>Just add the above lines (less comment line) and this should work for you.

slightly better is the following (in simple.el, hence preloaded):

  (defun turn-on-auto-fill ()
    "Unconditionally turn on Auto Fill mode."
    (auto-fill-mode 1))

allowing:

  (setq text-mode-hook 'turn-on-auto-fill)

Now, hooks can also be lists, so it might be better to make it a list.
--
/jr
jr@bbn.com or bbn!jr