help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set line wrap


From: Anselm Helbig
Subject: Re: How to set line wrap
Date: Tue, 22 Dec 2009 13:48:12 +0100

At Mon, 21 Dec 2009 15:56:06 -0800 (PST),
RAYHAN MUKTADER <address@hidden> wrote:
> 
> Hello,
> 
> Could some tell me how I can set the line wrap to 80 characters?
> 
> The following is what my ~/.emacs file currently looks like:
> 
> (set-fill-column 5)
> ;; Turn on tabs
> (setq indent-tabs-mode t)
> (setq-default indent-tabs-mode t)
> 
> ;; Bind the TAB key
> (global-set-key (kbd "TAB") 'self-insert-command)
> 
> ;; Set the tab width
> (setq default-tab-width 4)
> (setq tab-width 4)
> (setq c-basic-indent 4)
> (load-library "php-mode")
> (global-font-lock-mode t)
> 
> As you can see I have set fill column to 5 just to test it.
> However,  My my cursor does not move to the next line after I go pass
> five characters and I don't see any change in highlighting either.
> 
> I have also tried C-u 5 C-x f  but I did not see any difference.

Two things. See the docs for fill-column: 

  fill-column is a variable defined in `C source code'.
  Its value is 70

    Automatically becomes buffer-local when set in any fashion.
    This variable is safe as a file local variable if its value
    satisfies the predicate `integerp'.

So, when you set the fill column from your .emacs, this setting will
not apply to other buffers. To set a global default value use
setq-default:

  (setq-default fill-column 5)

Furthermore you have to make sure that auto-fill-mode is turned on,
otherwise your setting will have no effect. You usually only turn it on for
certain major modes, e.g. to turn it on for latex-mode you'd add this
to your .emacs:

  (add-hook 'latex-mode-hook 'turn-on-auto-fill)

You can of course also change the setting for fill-column in a
buffer-specific hook, using setq would make sense there. 

HTH, 

Anselm


-- 
Anselm Helbig - http://mnemonikk.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]