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.

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"

Reply via email to