all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to set line wrap
Date: Tue, 22 Dec 2009 13:48:12 +0100	[thread overview]
Message-ID: <87aaxbp437.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <76d3932e-13dd-40e7-b05a-d14eeac56574@q16g2000vbc.googlegroups.com>

At Mon, 21 Dec 2009 15:56:06 -0800 (PST),
RAYHAN MUKTADER <rmuktader@gmail.com> 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	other threads:[~2009-12-22 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-21 23:56 How to set line wrap RAYHAN MUKTADER
2009-12-22 12:48 ` Anselm Helbig [this message]
2009-12-22 14:21   ` RAYHAN MUKTADER
2009-12-22 14:32     ` Anselm Helbig
2009-12-22 15:07       ` RAYHAN MUKTADER
2009-12-22 15:16         ` Anselm Helbig
2009-12-22 21:23           ` RAYHAN MUKTADER
2009-12-22 21:54             ` Pascal J. Bourguignon
2009-12-22 22:35             ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aaxbp437.wl%anselm.helbig+news2009@googlemail.com \
    --to=anselm.helbig+news2009@googlemail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.