public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode
@ 2020-12-14 11:29 Andrea Corallo
  2021-07-19 11:11 ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Corallo @ 2020-12-14 11:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd

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

Hi all,

I've committed the attached patch as obvious.

This is to set `fill-column' to 80 in c-mode (Emacs default it to 70) so
now M-q does the right thing.  I think is very handy especially in
comments.

Question: should we update the copyright manually for this file or have
it updated by 'update-copyright.py'?  I think this is not scanning the
root of the repo.

Thanks

  Andrea


[-- Attachment #2: 0001-.dir-locals.el-Set-fill-column-to-80-for-c-mode.patch --]
[-- Type: text/plain, Size: 1082 bytes --]

From f60c1b3102791b98de7c1ce951bce335394682ca Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.corallo@arm.com>
Date: Fri, 11 Dec 2020 15:35:25 +0100
Subject: [PATCH] .dir-locals.el: Set 'fill-column' to 80 for c-mode

ChangeLog

2020-12-11  Andrea Corallo  <andrea.corallo@arm.com>

	* .dir-locals.el (c-mode): Set 'fill-column' to 80 columns.
---
 .dir-locals.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index b748c8d085f..44a0db68241 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -14,11 +14,10 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-(
- (tcl-mode . ((tcl-indent-level . 4)
+((tcl-mode . ((tcl-indent-level . 4)
 	      (tcl-continued-indent-level . 4)
 	      (indent-tabs-mode . t)))
  (nil . ((bug-reference-url-format . "http://gcc.gnu.org/PR%s")))
  (c-mode . ((c-file-style . "GNU")
-	    (indent-tabs-mode . t)))
-)
+	    (indent-tabs-mode . t)
+	    (fill-column . 80))))
-- 
2.17.1


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

* Re: [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode
  2020-12-14 11:29 [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode Andrea Corallo
@ 2021-07-19 11:11 ` Richard Earnshaw
  2021-07-19 13:52   ` Richard Sandiford
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2021-07-19 11:11 UTC (permalink / raw)
  To: Andrea Corallo, gcc-patches; +Cc: nd



On 14/12/2020 11:29, Andrea Corallo via Gcc-patches wrote:
> Hi all,
> 
> I've committed the attached patch as obvious.
> 
> This is to set `fill-column' to 80 in c-mode (Emacs default it to 70) so
> now M-q does the right thing.  I think is very handy especially in
> comments.
> 
> Question: should we update the copyright manually for this file or have
> it updated by 'update-copyright.py'?  I think this is not scanning the
> root of the repo.
> 
> Thanks
> 
>    Andrea
> 

Sorry for the very late reply to this, but I've only just tracked it 
down as the cause of why emacs had suddenly started to produce lines 
that were displaying with a line wrap (I'd add an image, but the mailing 
list would likely only strip it off).

The problem is that this allows a character to appear in column 80 and 
emacs then automatically inserts a blank line after it (when the window 
is 80 columns wide), which really messes up the formatting.

The wiki seems to suggest https://gcc.gnu.org/wiki/FormattingCodeForGCC 
that the line length should be 79 columns (see the textwidth setting); 
although that is not what is set contrib/vimrc.

Would anyone object if we reduced this by 1 (to 79) in both places?

R.

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

* Re: [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode
  2021-07-19 11:11 ` Richard Earnshaw
@ 2021-07-19 13:52   ` Richard Sandiford
  2021-07-19 15:41     ` Richard Earnshaw
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Sandiford @ 2021-07-19 13:52 UTC (permalink / raw)
  To: Richard Earnshaw via Gcc-patches; +Cc: Andrea Corallo, Richard Earnshaw, nd

Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On 14/12/2020 11:29, Andrea Corallo via Gcc-patches wrote:
>> Hi all,
>> 
>> I've committed the attached patch as obvious.
>> 
>> This is to set `fill-column' to 80 in c-mode (Emacs default it to 70) so
>> now M-q does the right thing.  I think is very handy especially in
>> comments.
>> 
>> Question: should we update the copyright manually for this file or have
>> it updated by 'update-copyright.py'?  I think this is not scanning the
>> root of the repo.
>> 
>> Thanks
>> 
>>    Andrea
>> 
>
> Sorry for the very late reply to this, but I've only just tracked it 
> down as the cause of why emacs had suddenly started to produce lines 
> that were displaying with a line wrap (I'd add an image, but the mailing 
> list would likely only strip it off).
>
> The problem is that this allows a character to appear in column 80 and 
> emacs then automatically inserts a blank line after it (when the window 
> is 80 columns wide), which really messes up the formatting.
>
> The wiki seems to suggest https://gcc.gnu.org/wiki/FormattingCodeForGCC 
> that the line length should be 79 columns (see the textwidth setting); 
> although that is not what is set contrib/vimrc.
>
> Would anyone object if we reduced this by 1 (to 79) in both places?

Sounds good to me FWIW.  (Having hit the same issue.)

Richard

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

* Re: [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode
  2021-07-19 13:52   ` Richard Sandiford
@ 2021-07-19 15:41     ` Richard Earnshaw
  2021-07-20  6:46       ` Richard Sandiford
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Earnshaw @ 2021-07-19 15:41 UTC (permalink / raw)
  To: Richard Earnshaw via Gcc-patches, Andrea Corallo, nd, richard.sandiford

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



On 19/07/2021 14:52, Richard Sandiford via Gcc-patches wrote:
> Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>> On 14/12/2020 11:29, Andrea Corallo via Gcc-patches wrote:
>>> Hi all,
>>>
>>> I've committed the attached patch as obvious.
>>>
>>> This is to set `fill-column' to 80 in c-mode (Emacs default it to 70) so
>>> now M-q does the right thing.  I think is very handy especially in
>>> comments.
>>>
>>> Question: should we update the copyright manually for this file or have
>>> it updated by 'update-copyright.py'?  I think this is not scanning the
>>> root of the repo.
>>>
>>> Thanks
>>>
>>>     Andrea
>>>
>>
>> Sorry for the very late reply to this, but I've only just tracked it
>> down as the cause of why emacs had suddenly started to produce lines
>> that were displaying with a line wrap (I'd add an image, but the mailing
>> list would likely only strip it off).
>>
>> The problem is that this allows a character to appear in column 80 and
>> emacs then automatically inserts a blank line after it (when the window
>> is 80 columns wide), which really messes up the formatting.
>>
>> The wiki seems to suggest https://gcc.gnu.org/wiki/FormattingCodeForGCC
>> that the line length should be 79 columns (see the textwidth setting);
>> although that is not what is set contrib/vimrc.
>>
>> Would anyone object if we reduced this by 1 (to 79) in both places?
> 
> Sounds good to me FWIW.  (Having hit the same issue.)
> 
> Richard
> 

So how about this?

--------------

Limit fill-column to 79

The current line-length limit is set to 80, but that allows a character 
to appear in the 80th column, and that causes emacs to display a 
line-wrap followed by a blank line when the display/window width is 80 
columns.  Furthermore, this seems to contradict the coding-style rules 
on the wiki which suggest that the line limit should be 79.

So reduce the line width in both the emacs control file and the contrib 
vimrc file to 79 characters.

ChangeLog:
	* .dir-local.el (c-mode): Change fill-column to 79.

contrib:
	* vimrc (textwidth): Change non-gitcommit length to 79.


[-- Attachment #2: fill.patch --]
[-- Type: text/x-patch, Size: 747 bytes --]

diff --git a/.dir-locals.el b/.dir-locals.el
index 44a0db68241..b07a0dc50d8 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -20,4 +20,4 @@
  (nil . ((bug-reference-url-format . "http://gcc.gnu.org/PR%s")))
  (c-mode . ((c-file-style . "GNU")
 	    (indent-tabs-mode . t)
-	    (fill-column . 80))))
+	    (fill-column . 79))))
diff --git a/contrib/vimrc b/contrib/vimrc
index 356d455b059..b7a8ab7360c 100644
--- a/contrib/vimrc
+++ b/contrib/vimrc
@@ -42,7 +42,7 @@ function! SetStyle()
   if &filetype == "gitcommit"
     setlocal textwidth=72
   else
-    setlocal textwidth=80
+    setlocal textwidth=79
   endif
   setlocal formatoptions-=ro formatoptions+=cqlt
   if index(l:c_exts, l:ext) != -1 || &filetype == "c" || &filetype == "cpp"

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

* Re: [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode
  2021-07-19 15:41     ` Richard Earnshaw
@ 2021-07-20  6:46       ` Richard Sandiford
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Sandiford @ 2021-07-20  6:46 UTC (permalink / raw)
  To: Richard Earnshaw via Gcc-patches; +Cc: Andrea Corallo, nd, Richard Earnshaw

Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On 19/07/2021 14:52, Richard Sandiford via Gcc-patches wrote:
>> Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>>> On 14/12/2020 11:29, Andrea Corallo via Gcc-patches wrote:
>>>> Hi all,
>>>>
>>>> I've committed the attached patch as obvious.
>>>>
>>>> This is to set `fill-column' to 80 in c-mode (Emacs default it to 70) so
>>>> now M-q does the right thing.  I think is very handy especially in
>>>> comments.
>>>>
>>>> Question: should we update the copyright manually for this file or have
>>>> it updated by 'update-copyright.py'?  I think this is not scanning the
>>>> root of the repo.
>>>>
>>>> Thanks
>>>>
>>>>     Andrea
>>>>
>>>
>>> Sorry for the very late reply to this, but I've only just tracked it
>>> down as the cause of why emacs had suddenly started to produce lines
>>> that were displaying with a line wrap (I'd add an image, but the mailing
>>> list would likely only strip it off).
>>>
>>> The problem is that this allows a character to appear in column 80 and
>>> emacs then automatically inserts a blank line after it (when the window
>>> is 80 columns wide), which really messes up the formatting.
>>>
>>> The wiki seems to suggest https://gcc.gnu.org/wiki/FormattingCodeForGCC
>>> that the line length should be 79 columns (see the textwidth setting);
>>> although that is not what is set contrib/vimrc.
>>>
>>> Would anyone object if we reduced this by 1 (to 79) in both places?
>> 
>> Sounds good to me FWIW.  (Having hit the same issue.)
>> 
>> Richard
>> 
>
> So how about this?
>
> --------------
>
> Limit fill-column to 79
>
> The current line-length limit is set to 80, but that allows a character 
> to appear in the 80th column, and that causes emacs to display a 
> line-wrap followed by a blank line when the display/window width is 80 
> columns.  Furthermore, this seems to contradict the coding-style rules 
> on the wiki which suggest that the line limit should be 79.
>
> So reduce the line width in both the emacs control file and the contrib 
> vimrc file to 79 characters.
>
> ChangeLog:
> 	* .dir-local.el (c-mode): Change fill-column to 79.
>
> contrib:
> 	* vimrc (textwidth): Change non-gitcommit length to 79.

LGTM, thanks.

Richard

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

end of thread, other threads:[~2021-07-20  6:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 11:29 [committed] .dir-locals.el: Set 'fill-column' to 80 for c-mode Andrea Corallo
2021-07-19 11:11 ` Richard Earnshaw
2021-07-19 13:52   ` Richard Sandiford
2021-07-19 15:41     ` Richard Earnshaw
2021-07-20  6:46       ` Richard Sandiford

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).