all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* automatic new-line after 80 columns
@ 2009-02-17 19:20 Rodrigo Canellas
  0 siblings, 0 replies; 8+ messages in thread
From: Rodrigo Canellas @ 2009-02-17 19:20 UTC (permalink / raw)
  To: Emacs Help List

Hi,

I really can not find how to set 'emacs' to add a new-line when the line reaches the 80th column. 

In 'ccmode', I set it fot the comments, but I would like to define for C++ code as well.

Can anyone help me?

Thanks a lot!



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





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

* Re: automatic new-line after 80 columns
       [not found] <mailman.1006.1234898438.31690.help-gnu-emacs@gnu.org>
@ 2009-02-17 22:21 ` B. T. Raven
  2009-02-18 14:25   ` Rodrigo Canellas
       [not found]   ` <mailman.1068.1234967171.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: B. T. Raven @ 2009-02-17 22:21 UTC (permalink / raw)
  To: help-gnu-emacs

Rodrigo Canellas wrote:
> Hi,
> 
> I really can not find how to set 'emacs' to add a new-line when the line reaches the 80th column. 
> 
> In 'ccmode', I set it fot the comments, but I would like to define for C++ code as well.
> 
> Can anyone help me?
> 
> Thanks a lot!
> 
> 
> 

How does what you want differ from the behavior you see if you type this 
in a buffer:

C-u 80 C-x f C-u 1 M-x auto-fill-mode

??
I think this is a minor mode that works with most programming languages.

Ed


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

* Re: automatic new-line after 80 columns
  2009-02-17 22:21 ` automatic new-line after 80 columns B. T. Raven
@ 2009-02-18 14:25   ` Rodrigo Canellas
  2009-02-18 16:58     ` tyler
       [not found]   ` <mailman.1068.1234967171.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Rodrigo Canellas @ 2009-02-18 14:25 UTC (permalink / raw)
  To: help-gnu-emacs

Em Tuesday 17 February 2009 19:21:10 B. T. Raven escreveu:
> Rodrigo Canellas wrote:
> > Hi,
> > 
> > I really can not find how to set 'emacs' to add a new-line when the line reaches the 80th column. 
> > 
> > In 'ccmode', I set it fot the comments, but I would like to define for C++ code as well.
> > 
> > Can anyone help me?
> > 
> > Thanks a lot!
> > 
> > 
> > 
> 
> How does what you want differ from the behavior you see if you type this 
> in a buffer:
> 
> C-u 80 C-x f C-u 1 M-x auto-fill-mode
> 
> ??
> I think this is a minor mode that works with most programming languages.
> 
> Ed
> 

I created a file '/var/tmp/t.cpp'.
Then when I typed 'C-u 80 C-x f', 'emacs' said 'Fill column set to 80 (was 70)'
And when I typed 'C-u 1 M-x auto-fill-mode', it did not say anything.

I typed this:
#include <iostream>


void function_very_very_very_big_but_i_mean_really_big ( ) {
    {
	{
	    {
		{
		    {
			{
			    {
				{
				    {
					{
					    {
						{
						    {
							{
							    {
								object_a = fc_abc( ) ;


Here I expected it would change to:

void function_very_very_very_big_but_i_mean_really_big ( ) {
    {
	{
	    {
		{
		    {
			{
			    {
				{
				    {
					{
					    {
						{
						    {
							{
							    {
								object_a = 
                                                                      fc_abc( ) ;



I mean, to respect  the limit of 80 bytes per line, 'emacs' should insert a new-line after the '='.

Any ideas?

Thanks!

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





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

* Re: automatic new-line after 80 columns
  2009-02-18 14:25   ` Rodrigo Canellas
@ 2009-02-18 16:58     ` tyler
  2009-02-18 18:49       ` Rodrigo Canellas
  0 siblings, 1 reply; 8+ messages in thread
From: tyler @ 2009-02-18 16:58 UTC (permalink / raw)
  To: help-gnu-emacs

Rodrigo Canellas <rodrigo.canellas@tqtvd.com> writes:

>
> I created a file '/var/tmp/t.cpp'.
> Then when I typed 'C-u 80 C-x f', 'emacs' said 'Fill column set to 80 (was 70)'
> And when I typed 'C-u 1 M-x auto-fill-mode', it did not say anything.

You need to customize c-ignore-auto-fill. By default autofill only works
for c comments, but you can change this so that it works in code too.
After doing this you example worked like you wanted it to (you may need
to hit the tab key to get the filling to work after the line break is
added).

Tyler

-- 
Don't learn the tricks of the trade; learn the trade.





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

* Re: automatic new-line after 80 columns
       [not found]   ` <mailman.1068.1234967171.31690.help-gnu-emacs@gnu.org>
@ 2009-02-18 17:23     ` B. T. Raven
  2009-02-18 18:30       ` Rodrigo Canellas
  0 siblings, 1 reply; 8+ messages in thread
From: B. T. Raven @ 2009-02-18 17:23 UTC (permalink / raw)
  To: help-gnu-emacs

Rodrigo Canellas wrote:
> Em Tuesday 17 February 2009 19:21:10 B. T. Raven escreveu:
>> Rodrigo Canellas wrote:
>>> Hi,
>>>
>>> I really can not find how to set 'emacs' to add a new-line when the line reaches the 80th column. 
>>>
>>> In 'ccmode', I set it fot the comments, but I would like to define for C++ code as well.
>>>
>>> Can anyone help me?
>>>
>>> Thanks a lot!
>>>
>>>
>>>
>> How does what you want differ from the behavior you see if you type this 
>> in a buffer:
>>
>> C-u 80 C-x f C-u 1 M-x auto-fill-mode
>>
>> ??
>> I think this is a minor mode that works with most programming languages.
>>
>> Ed
>>
> 
> I created a file '/var/tmp/t.cpp'.
> Then when I typed 'C-u 80 C-x f', 'emacs' said 'Fill column set to 80 (was 70)'
> And when I typed 'C-u 1 M-x auto-fill-mode', it did not say anything.

You should see the word "Fill" added to the mode line.
> 
> I typed this:
> #include <iostream>
> 
> 
> void function_very_very_very_big_but_i_mean_really_big ( ) {
>     {
> 	{
> 	    {
> 		{
> 		    {
> 			{
> 			    {
> 				{
> 				    {
> 					{
> 					    {
> 						{
> 						    {
> 							{
> 							    {
> 								object_a = fc_abc( ) ;
> 
> 
> Here I expected it would change to:
> 
> void function_very_very_very_big_but_i_mean_really_big ( ) {
>     {
> 	{
> 	    {
> 		{
> 		    {
> 			{
> 			    {
> 				{
> 				    {
> 					{
> 					    {
> 						{
> 						    {
> 							{
> 							    {
> 								object_a = 
>                                                                       fc_abc( ) ;
> 
> 
> 
> I mean, to respect  the limit of 80 bytes per line, 'emacs' should insert a new-line after the '='.
> 
> Any ideas?

I copy-pasted the above into an Emacs buffer, enabled column-mode, and 
didn't see any lines longer than 78 characters. Auto-fill just breaks 
the line automatically at the word boundary at or just before the 
fill-width character.

Type this:

Now is the time for every good man to come to the aid of every good man who
types

and it should have broken before the word "types."

The above works in a lisp buffer but not in a new one I made (junk.cpp). 
Maybe its working depends on c++ syntax. Did you try menu C++ > Toggle > 
Auto newline?


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

* Re: automatic new-line after 80 columns
  2009-02-18 17:23     ` B. T. Raven
@ 2009-02-18 18:30       ` Rodrigo Canellas
  0 siblings, 0 replies; 8+ messages in thread
From: Rodrigo Canellas @ 2009-02-18 18:30 UTC (permalink / raw)
  To: help-gnu-emacs

Em Wednesday 18 February 2009 14:23:41 B. T. Raven escreveu:
> Rodrigo Canellas wrote:
> > Em Tuesday 17 February 2009 19:21:10 B. T. Raven escreveu:
> >> Rodrigo Canellas wrote:
> >>> Hi,
> >>>
> >>> I really can not find how to set 'emacs' to add a new-line when the line reaches the 80th column. 
> >>>
> >>> In 'ccmode', I set it fot the comments, but I would like to define for C++ code as well.
> >>>
> >>> Can anyone help me?
> >>>
> >>> Thanks a lot!
> >>>
> >>>
> >>>
> >> How does what you want differ from the behavior you see if you type this 
> >> in a buffer:
> >>
> >> C-u 80 C-x f C-u 1 M-x auto-fill-mode
> >>
> >> ??
> >> I think this is a minor mode that works with most programming languages.
> >>
> >> Ed
> >>
> > 
> > I created a file '/var/tmp/t.cpp'.
> > Then when I typed 'C-u 80 C-x f', 'emacs' said 'Fill column set to 80 (was 70)'
> > And when I typed 'C-u 1 M-x auto-fill-mode', it did not say anything.
> 
> You should see the word "Fill" added to the mode line.
> > 
> > I typed this:
> > #include <iostream>
> > 
> > 
> > void function_very_very_very_big_but_i_mean_really_big ( ) {
> >     {
> > 	{
> > 	    {
> > 		{
> > 		    {
> > 			{
> > 			    {
> > 				{
> > 				    {
> > 					{
> > 					    {
> > 						{
> > 						    {
> > 							{
> > 							    {
> > 								object_a = fc_abc( ) ;
> > 
> > 
> > Here I expected it would change to:
> > 
> > void function_very_very_very_big_but_i_mean_really_big ( ) {
> >     {
> > 	{
> > 	    {
> > 		{
> > 		    {
> > 			{
> > 			    {
> > 				{
> > 				    {
> > 					{
> > 					    {
> > 						{
> > 						    {
> > 							{
> > 							    {
> > 								object_a = 
> >                                                                       fc_abc( ) ;
> > 
> > 
> > 
> > I mean, to respect  the limit of 80 bytes per line, 'emacs' should insert a new-line after the '='.
> > 
> > Any ideas?
> 
> I copy-pasted the above into an Emacs buffer, enabled column-mode, and 
> didn't see any lines longer than 78 characters. Auto-fill just breaks 
> the line automatically at the word boundary at or just before the 
> fill-width character.
> 
> Type this:
> 
> Now is the time for every good man to come to the aid of every good man who
> types
> 
> and it should have broken before the word "types."
> 
> The above works in a lisp buffer but not in a new one I made (junk.cpp). 
> Maybe its working depends on c++ syntax. Did you try menu C++ > Toggle > 
> Auto newline?
> 

I  see the word 'Fill' in the mode line. I typed a line more than 80 bytes long in '*scratch*', and 'emacs' added a new line for me. 
But when I type in a C++ buffer it does no work. I guess I have to do what Tyler suggested, altough I have no idea how... 

Thanks anyway!


-- 
Rodrigo Canellas
Software Developer
Digital TV Products
+55 21 3147-3000/8675
rodrigo.canellas@tqtvd.com
www.tqtvd.com 
TQTVD Software

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





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

* Re: automatic new-line after 80 columns
  2009-02-18 16:58     ` tyler
@ 2009-02-18 18:49       ` Rodrigo Canellas
  2009-03-17 13:09         ` Nishith Nand
  0 siblings, 1 reply; 8+ messages in thread
From: Rodrigo Canellas @ 2009-02-18 18:49 UTC (permalink / raw)
  To: help-gnu-emacs

Em Wednesday 18 February 2009 13:58:45 tyler escreveu:
> Rodrigo Canellas <rodrigo.canellas@tqtvd.com> writes:
> 
> >
> > I created a file '/var/tmp/t.cpp'.
> > Then when I typed 'C-u 80 C-x f', 'emacs' said 'Fill column set to 80 (was 70)'
> > And when I typed 'C-u 1 M-x auto-fill-mode', it did not say anything.
> 
> You need to customize c-ignore-auto-fill. By default autofill only works
> for c comments, but you can change this so that it works in code too.
> After doing this you example worked like you wanted it to (you may need
> to hit the tab key to get the filling to work after the line break is
> added).
> 
> Tyler
> 


OK! 

I inserted 

 '(fill-column 80)
 '(c-ignore-auto-fill (quote (string cpp)))

in my '.emacs' file and it worked fine!!


Thanks a lot!!

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





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

* Re: automatic new-line after 80 columns
  2009-02-18 18:49       ` Rodrigo Canellas
@ 2009-03-17 13:09         ` Nishith Nand
  0 siblings, 0 replies; 8+ messages in thread
From: Nishith Nand @ 2009-03-17 13:09 UTC (permalink / raw)
  To: Rodrigo Canellas; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

>
> OK!
>
> I inserted
>
>  '(fill-column 80)
>  '(c-ignore-auto-fill (quote (string cpp)))
>
> in my '.emacs' file and it worked fine!!
>

Hi,

    I have the exact same requirement. I tried adding those lines to my
.emacs and then wrote the following line in a file called test.cpp

int a = b = c = d = e = f = g = h = i = j = k = l = m = n = o = p = q = r =
s = t = u = v = w = x = y = z = 0;

But, unfortunately, no newline.

I enabled auto newline (C-c C-a).
I tried both c and c++ mode.
The Fill minor mode is enabled.

I am using 23.0.60.1 GTK Snapshot on ubuntu 9.04 alpha 6.

Any suggestions?

Thanks and Regards,
Nishith Nand

[-- Attachment #2: Type: text/html, Size: 949 bytes --]

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

end of thread, other threads:[~2009-03-17 13:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1006.1234898438.31690.help-gnu-emacs@gnu.org>
2009-02-17 22:21 ` automatic new-line after 80 columns B. T. Raven
2009-02-18 14:25   ` Rodrigo Canellas
2009-02-18 16:58     ` tyler
2009-02-18 18:49       ` Rodrigo Canellas
2009-03-17 13:09         ` Nishith Nand
     [not found]   ` <mailman.1068.1234967171.31690.help-gnu-emacs@gnu.org>
2009-02-18 17:23     ` B. T. Raven
2009-02-18 18:30       ` Rodrigo Canellas
2009-02-17 19:20 Rodrigo Canellas

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.