public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] contrib/vimrc: Reduce textwidth for commit messages
@ 2020-04-28  4:31 Patrick Palka
  2020-04-29 17:06 ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Palka @ 2020-04-28  4:31 UTC (permalink / raw)
  To: gcc-patches

The bundled vimrc script, when enabled, currently sets the text width to
80 characters for all files within the source directory.  Unfortunately
this means the setting also applies when editing .git/COMMIT_EDITMSG,
overriding the default and standard text width of 72 for Git commit
messages.  (A text width of 80 is too much for commit messages because
Git indents commit messages by four spaces when displaying them via e.g.
git log, leading to a total displayed width of 84 characters.)

This patch explicitly sets the text width of Git commit messages to 72
characters in accordance with standard practice.  (Alternatively we
could avoid setting textwidth at all in this case and let the defaults
kick in, but maybe it's better to be explicit?)

Tested by writing up this commit message :)  Is this OK to commit?

contrib/ChangeLog:

	* vimrc: Reduce textwidth to 72 for Git commit messages.
---
 contrib/vimrc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/vimrc b/contrib/vimrc
index fa0208d5beb..c207eead2e4 100644
--- a/contrib/vimrc
+++ b/contrib/vimrc
@@ -39,7 +39,11 @@ function! SetStyle()
     setlocal shiftwidth=2
     setlocal noexpandtab
   endif
-  setlocal textwidth=80
+  if &filetype == "gitcommit"
+    setlocal textwidth=72
+  else
+    setlocal textwidth=80
+  endif
   setlocal formatoptions-=ro formatoptions+=cqlt
   if index(l:c_exts, l:ext) != -1
     setlocal cindent
-- 
2.26.2.266.ge870325ee8


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

* Re: [PATCH] contrib/vimrc: Reduce textwidth for commit messages
  2020-04-28  4:31 [PATCH] contrib/vimrc: Reduce textwidth for commit messages Patrick Palka
@ 2020-04-29 17:06 ` Jeff Law
  2020-04-29 17:14   ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2020-04-29 17:06 UTC (permalink / raw)
  To: Patrick Palka, gcc-patches

On Tue, 2020-04-28 at 00:31 -0400, Patrick Palka via Gcc-patches wrote:
> The bundled vimrc script, when enabled, currently sets the text width to
> 80 characters for all files within the source directory.  Unfortunately
> this means the setting also applies when editing .git/COMMIT_EDITMSG,
> overriding the default and standard text width of 72 for Git commit
> messages.  (A text width of 80 is too much for commit messages because
> Git indents commit messages by four spaces when displaying them via e.g.
> git log, leading to a total displayed width of 84 characters.)
> 
> This patch explicitly sets the text width of Git commit messages to 72
> characters in accordance with standard practice.  (Alternatively we
> could avoid setting textwidth at all in this case and let the defaults
> kick in, but maybe it's better to be explicit?)
> 
> Tested by writing up this commit message :)  Is this OK to commit?
> 
> contrib/ChangeLog:
> 
> 	* vimrc: Reduce textwidth to 72 for Git commit messages.
OK
jeff


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

* Re: [PATCH] contrib/vimrc: Reduce textwidth for commit messages
  2020-04-29 17:06 ` Jeff Law
@ 2020-04-29 17:14   ` Jakub Jelinek
  2020-05-04 18:18     ` Martin Liška
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2020-04-29 17:14 UTC (permalink / raw)
  To: law; +Cc: Patrick Palka, gcc-patches

On Wed, Apr 29, 2020 at 11:06:27AM -0600, Jeff Law via Gcc-patches wrote:
> On Tue, 2020-04-28 at 00:31 -0400, Patrick Palka via Gcc-patches wrote:
> > The bundled vimrc script, when enabled, currently sets the text width to
> > 80 characters for all files within the source directory.  Unfortunately
> > this means the setting also applies when editing .git/COMMIT_EDITMSG,
> > overriding the default and standard text width of 72 for Git commit
> > messages.  (A text width of 80 is too much for commit messages because
> > Git indents commit messages by four spaces when displaying them via e.g.
> > git log, leading to a total displayed width of 84 characters.)
> > 
> > This patch explicitly sets the text width of Git commit messages to 72
> > characters in accordance with standard practice.  (Alternatively we
> > could avoid setting textwidth at all in this case and let the defaults
> > kick in, but maybe it's better to be explicit?)
> > 
> > Tested by writing up this commit message :)  Is this OK to commit?
> > 
> > contrib/ChangeLog:
> > 
> > 	* vimrc: Reduce textwidth to 72 for Git commit messages.
> OK

Though, if we go for the ChangeLog entries in commit messages as the source
for auto-appended ChangeLog files during DATESTAMP update, as Martin Liska
is working on - see https://github.com/marxin/gcc-changelog/ -
won't this cause people to wrap ChangeLog entries too early in there?
Because for the script what git log --format=%B is what really matters.

	Jakub


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

* Re: [PATCH] contrib/vimrc: Reduce textwidth for commit messages
  2020-04-29 17:14   ` Jakub Jelinek
@ 2020-05-04 18:18     ` Martin Liška
  2020-05-13 12:59       ` Martin Liška
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Liška @ 2020-05-04 18:18 UTC (permalink / raw)
  To: Jakub Jelinek, law; +Cc: gcc-patches

On 4/29/20 7:14 PM, Jakub Jelinek via Gcc-patches wrote:
> On Wed, Apr 29, 2020 at 11:06:27AM -0600, Jeff Law via Gcc-patches wrote:
>> On Tue, 2020-04-28 at 00:31 -0400, Patrick Palka via Gcc-patches wrote:
>>> The bundled vimrc script, when enabled, currently sets the text width to
>>> 80 characters for all files within the source directory.  Unfortunately
>>> this means the setting also applies when editing .git/COMMIT_EDITMSG,
>>> overriding the default and standard text width of 72 for Git commit
>>> messages.  (A text width of 80 is too much for commit messages because
>>> Git indents commit messages by four spaces when displaying them via e.g.
>>> git log, leading to a total displayed width of 84 characters.)
>>>
>>> This patch explicitly sets the text width of Git commit messages to 72
>>> characters in accordance with standard practice.  (Alternatively we
>>> could avoid setting textwidth at all in this case and let the defaults
>>> kick in, but maybe it's better to be explicit?)
>>>
>>> Tested by writing up this commit message :)  Is this OK to commit?
>>>
>>> contrib/ChangeLog:
>>>
>>> 	* vimrc: Reduce textwidth to 72 for Git commit messages.
>> OK
> 
> Though, if we go for the ChangeLog entries in commit messages as the source
> for auto-appended ChangeLog files during DATESTAMP update, as Martin Liska
> is working on - see https://github.com/marxin/gcc-changelog/ -
> won't this cause people to wrap ChangeLog entries too early in there?

Hi.

It seems that 'git 50/72' rule of thumb is well established term used in Git world:
https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
https://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting

I would follow it as well. People normally use git log with no arguments and
the leading 4 spaces will be displayed.

I support the patch,
Martin

> Because for the script what git log --format=%B is what really matters.
> 
> 	Jakub
> 


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

* Re: [PATCH] contrib/vimrc: Reduce textwidth for commit messages
  2020-05-04 18:18     ` Martin Liška
@ 2020-05-13 12:59       ` Martin Liška
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Liška @ 2020-05-13 12:59 UTC (permalink / raw)
  To: Jakub Jelinek, law; +Cc: gcc-patches

On 5/4/20 8:18 PM, Martin Liška wrote:
> I support the patch,

And as there's no feedback I also installed the patch.

Martin

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

end of thread, other threads:[~2020-05-13 12:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  4:31 [PATCH] contrib/vimrc: Reduce textwidth for commit messages Patrick Palka
2020-04-29 17:06 ` Jeff Law
2020-04-29 17:14   ` Jakub Jelinek
2020-05-04 18:18     ` Martin Liška
2020-05-13 12:59       ` Martin Liška

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