unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to set line wrap
@ 2009-12-21 23:56 RAYHAN MUKTADER
  2009-12-22 12:48 ` Anselm Helbig
  0 siblings, 1 reply; 9+ messages in thread
From: RAYHAN MUKTADER @ 2009-12-21 23:56 UTC (permalink / raw)
  To: help-gnu-emacs

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.
Kindly help.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-21 23:56 How to set line wrap RAYHAN MUKTADER
@ 2009-12-22 12:48 ` Anselm Helbig
  2009-12-22 14:21   ` RAYHAN MUKTADER
  0 siblings, 1 reply; 9+ messages in thread
From: Anselm Helbig @ 2009-12-22 12:48 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-22 12:48 ` Anselm Helbig
@ 2009-12-22 14:21   ` RAYHAN MUKTADER
  2009-12-22 14:32     ` Anselm Helbig
  0 siblings, 1 reply; 9+ messages in thread
From: RAYHAN MUKTADER @ 2009-12-22 14:21 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 22, 7:48 am, Anselm Helbig <anselm.helbig
+news2...@googlemail.com> wrote:
> At Mon, 21 Dec 2009 15:56:06 -0800 (PST),
>
>
>
> RAYHAN MUKTADER <rmukta...@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

Thank you for your reply.
I have already tried C-u 5 C-x f.  It did not do anything.
Are you recommending that I put the following in my ~/.emacs?

(setq-default fill-column 5)
(add-hook 'php-mode-hook 'turn-on-auto-fill)

I've never tried to personalize Emacs before.  So, please correct me
if I am making a mistake.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-22 14:21   ` RAYHAN MUKTADER
@ 2009-12-22 14:32     ` Anselm Helbig
  2009-12-22 15:07       ` RAYHAN MUKTADER
  0 siblings, 1 reply; 9+ messages in thread
From: Anselm Helbig @ 2009-12-22 14:32 UTC (permalink / raw)
  To: help-gnu-emacs

Hi!

> > > Could some tell me how I can set the line wrap to 80 characters?
> [...]
> Thank you for your reply.
> I have already tried C-u 5 C-x f.  It did not do anything.
> Are you recommending that I put the following in my ~/.emacs?
> 
> (setq-default fill-column 5)
> (add-hook 'php-mode-hook 'turn-on-auto-fill)
> 
> I've never tried to personalize Emacs before.  So, please correct me
> if I am making a mistake.

Go on, try it! It won't reformat you hard drive. 8-) Also, Emacs is
all about customization, but you'll have to learn a little bit of
elisp to grasp what is going on. See e.g.

  http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html

or of course the elisp intro that comes with Emacs. 

HTH, 

Anselm


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-22 14:32     ` Anselm Helbig
@ 2009-12-22 15:07       ` RAYHAN MUKTADER
  2009-12-22 15:16         ` Anselm Helbig
  0 siblings, 1 reply; 9+ messages in thread
From: RAYHAN MUKTADER @ 2009-12-22 15:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 22, 9:32 am, Anselm Helbig <anselm.helbig
+news2...@googlemail.com> wrote:
> Hi!
>
> > > > Could some tell me how I can set the line wrap to 80 characters?
> > [...]
> > Thank you for your reply.
> > I have already tried C-u 5 C-x f.  It did not do anything.
> > Are you recommending that I put the following in my ~/.emacs?
>
> > (setq-default fill-column 5)
> > (add-hook 'php-mode-hook 'turn-on-auto-fill)
>
> > I've never tried to personalize Emacs before.  So, please correct me
> > if I am making a mistake.
>
> Go on, try it! It won't reformat you hard drive. 8-) Also, Emacs is
> all about customization, but you'll have to learn a little bit of
> elisp to grasp what is going on. See e.g.
>
>  http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html
>
> or of course the elisp intro that comes with Emacs.
>
> HTH,
>
> Anselm
>
> --
> Anselm Helbig -http://mnemonikk.org/
I just tried it.  I don't notice anything different.
What should I be looking for?  Should the color change after five
characters?
I will read the link you've provided.
Thank you for your prompt response.  It is very much appreciated.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-22 15:07       ` RAYHAN MUKTADER
@ 2009-12-22 15:16         ` Anselm Helbig
  2009-12-22 21:23           ` RAYHAN MUKTADER
  0 siblings, 1 reply; 9+ messages in thread
From: Anselm Helbig @ 2009-12-22 15:16 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

> > > > > Could some tell me how I can set the line wrap to 80 characters?
> > > [...]
> > > Thank you for your reply.
> > > I have already tried C-u 5 C-x f.  It did not do anything.
> > > Are you recommending that I put the following in my ~/.emacs?
> >
> > > (setq-default fill-column 5)
> > > (add-hook 'php-mode-hook 'turn-on-auto-fill)
> >
> > > I've never tried to personalize Emacs before.  So, please correct me
> > > if I am making a mistake.
>
> [...]
>
> I just tried it.  I don't notice anything different.
> What should I be looking for?  Should the color change after five
> characters?

For php-mode auto-fill seems to only work within comments - in general
it doesn't make much sense to use auto-fill for programming. Start
typing a PHP comment and you'll see what auto-fill-mode does.

Regards, 

Anselm


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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  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
  0 siblings, 2 replies; 9+ messages in thread
From: RAYHAN MUKTADER @ 2009-12-22 21:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 22, 10:16 am, Anselm Helbig <anselm.helbig
+news2...@googlemail.com> wrote:
> > > > > > Could some tell me how I can set the line wrap to 80 characters?
> > > > [...]
> > > > Thank you for your reply.
> > > > I have already tried C-u 5 C-x f.  It did not do anything.
> > > > Are you recommending that I put the following in my ~/.emacs?
>
> > > > (setq-default fill-column 5)
> > > > (add-hook 'php-mode-hook 'turn-on-auto-fill)
>
> > > > I've never tried to personalize Emacs before.  So, please correct me
> > > > if I am making a mistake.
>
> > [...]
>
> > I just tried it.  I don't notice anything different.
> > What should I be looking for?  Should the color change after five
> > characters?
>
> For php-mode auto-fill seems to only work within comments - in general
> it doesn't make much sense to use auto-fill for programming. Start
> typing a PHP comment and you'll see what auto-fill-mode does.
>
> Regards,
>
> Anselm
>
> --
> Anselm Helbig -http://mnemonikk.org/

I did not see any change with comments either.  O well.  I just wanted
some sort of warning if I exceed 80 characters in a single line.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to set line wrap
  2009-12-22 21:23           ` RAYHAN MUKTADER
@ 2009-12-22 21:54             ` Pascal J. Bourguignon
  2009-12-22 22:35             ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-22 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

RAYHAN MUKTADER <rmuktader@gmail.com> writes:

> On Dec 22, 10:16 am, Anselm Helbig <anselm.helbig
> +news2...@googlemail.com> wrote:
>> > > > > > Could some tell me how I can set the line wrap to 80 characters?
>> > > > [...]
>> > > > Thank you for your reply.
>> > > > I have already tried C-u 5 C-x f.  It did not do anything.
>> > > > Are you recommending that I put the following in my ~/.emacs?
>>
>> > > > (setq-default fill-column 5)
>> > > > (add-hook 'php-mode-hook 'turn-on-auto-fill)
>>
>> > > > I've never tried to personalize Emacs before.  So, please correct me
>> > > > if I am making a mistake.
>>
>> > [...]
>>
>> > I just tried it.  I don't notice anything different.
>> > What should I be looking for?  Should the color change after five
>> > characters?
>>
>> For php-mode auto-fill seems to only work within comments - in general
>> it doesn't make much sense to use auto-fill for programming. Start
>> typing a PHP comment and you'll see what auto-fill-mode does.
>>
>> Regards,
>>
>> Anselm
>>
>> --
>> Anselm Helbig -http://mnemonikk.org/
>
> I did not see any change with comments either.  O well.  I just wanted
> some sort of warning if I exceed 80 characters in a single line.

(when (require 'column-marker nil t)
  (column-marker-1 80))

There are three pre-defined column markers, but you can easily add
more if you need them.  This displays the characters under the
specified column in a specific face.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Klingon function calls do not have "parameters" -- they have
"arguments" and they ALWAYS WIN THEM."


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: How to set line wrap
  2009-12-22 21:23           ` RAYHAN MUKTADER
  2009-12-22 21:54             ` Pascal J. Bourguignon
@ 2009-12-22 22:35             ` Drew Adams
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2009-12-22 22:35 UTC (permalink / raw)
  To: 'RAYHAN MUKTADER', help-gnu-emacs

> I just wanted some sort of warning if I exceed 80 characters
> in a single line.

http://www.emacswiki.org/emacs/EightyColumnRule

See especially the pages _linked from_ that page for several different ways to
highlight or find long lines.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-12-22 22:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-21 23:56 How to set line wrap RAYHAN MUKTADER
2009-12-22 12:48 ` Anselm Helbig
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).