unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* lm-verify, long copyright line
@ 2017-06-22 22:51 Mike Kupfer
  2017-06-22 23:26 ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Kupfer @ 2017-06-22 22:51 UTC (permalink / raw)
  To: emacs-devel

(lm-verify "mh-e.el") in master complains that the copyright holder is
not the Free Software Foundation, apparently because the copyright
statement wraps:

;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2017 Free
;; Software Foundation, Inc.

https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html says
that it's okay to split the notice across multiple lines, but lm-verify
apparently doesn't understand that.  Should I ignore the complaint, or
reorganize the statement into multiple lines which each contain the
string "Free Software Foundation", or...?

thanks,
mike



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

* Re: lm-verify, long copyright line
  2017-06-22 22:51 lm-verify, long copyright line Mike Kupfer
@ 2017-06-22 23:26 ` Paul Eggert
  2017-06-22 23:57   ` Mike Kupfer
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-22 23:26 UTC (permalink / raw)
  To: Mike Kupfer, emacs-devel

On 06/22/2017 03:51 PM, Mike Kupfer wrote:
> Should I ignore the complaint, or
> reorganize the statement into multiple lines which each contain the
> string "Free Software Foundation", or...?

I wouldn't reorganize the statement, as it's likely to be re-reorganized 
in January 2018 when we update the copyright years automatically. 
Instead, I'd either ignore the complaint or better yet fix lm-verify 
(the latter should be pretty simple, just change a string match to a 
regex match).




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

* Re: lm-verify, long copyright line
  2017-06-22 23:26 ` Paul Eggert
@ 2017-06-22 23:57   ` Mike Kupfer
  2017-06-23  0:07     ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Kupfer @ 2017-06-22 23:57 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

Paul Eggert wrote:

> Instead, I'd either ignore the complaint or better yet
> fix lm-verify (the latter should be pretty simple, just change a
> string match to a regex match).

I started looking at lm-verify, and I realized that it expects the
additional line(s) to be indented.  So it's happy with

;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2017 Free
;;   Software Foundation, Inc.

Will the copyright update in 2018 break this?

mike



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

* Re: lm-verify, long copyright line
  2017-06-22 23:57   ` Mike Kupfer
@ 2017-06-23  0:07     ` Paul Eggert
  2017-06-23  0:28       ` Mike Kupfer
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-23  0:07 UTC (permalink / raw)
  To: Mike Kupfer; +Cc: emacs-devel

On 06/22/2017 04:57 PM, Mike Kupfer wrote:
> Will the copyright update in 2018 break this?

Although I don't know offhand, you should be able to find out by running 
the shell command:

UPDATE_COPYRIGHT_YEAR=2018 admin/update-copyright

on a scratch copy of the source code.




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

* Re: lm-verify, long copyright line
  2017-06-23  0:07     ` Paul Eggert
@ 2017-06-23  0:28       ` Mike Kupfer
  2017-06-23  4:18         ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Kupfer @ 2017-06-23  0:28 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

Paul Eggert wrote:

> On 06/22/2017 04:57 PM, Mike Kupfer wrote:
> > Will the copyright update in 2018 break this?
> 
> Although I don't know offhand, you should be able to find out by
> running the shell command:
> 
> UPDATE_COPYRIGHT_YEAR=2018 admin/update-copyright
> 
> on a scratch copy of the source code.

The good news is that it successfully changes the final year in mh-e.el
from 2017 to 2018.  The bad news is that it removes the indentation in
the second line.

It looks fairly straightforward to change the update-copyright script to
add some indentation when there's a line wrap.  Would that be
acceptable?

mike



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

* Re: lm-verify, long copyright line
  2017-06-23  0:28       ` Mike Kupfer
@ 2017-06-23  4:18         ` Paul Eggert
  2017-06-23 16:19           ` Stefan Monnier
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-23  4:18 UTC (permalink / raw)
  To: Mike Kupfer; +Cc: emacs-devel

Mike Kupfer wrote:
> It looks fairly straightforward to change the update-copyright script to
> add some indentation when there's a line wrap.  Would that be
> acceptable?

Quite possibly not, as the script is imported from gnulib and I expect other 
users are used to the current behavior and will see glitches if it starts 
indenting differently. Better would be to add an option to the script to enable 
the behavior you prefer.

However, why does lm-verify insist on unequal indentation in the copyright 
notice? It seems like a weird constraint. Wouldn't it be better to fix that than 
to modify update-copyright? Not every copyright notice is processed by 
update-copyright.



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

* Re: lm-verify, long copyright line
  2017-06-23  4:18         ` Paul Eggert
@ 2017-06-23 16:19           ` Stefan Monnier
  2017-06-23 17:13             ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier @ 2017-06-23 16:19 UTC (permalink / raw)
  To: emacs-devel

> However, why does lm-verify insist on unequal indentation in the copyright
> notice? It seems like a weird constraint.

Because all the lm-* thingies use leading spaces to distinguish line
continuations (along the same lines as what RFC822 does).
It doesn't look weird to me at all.


        Stefan




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

* Re: lm-verify, long copyright line
  2017-06-23 16:19           ` Stefan Monnier
@ 2017-06-23 17:13             ` Paul Eggert
  2017-06-23 17:59               ` Glenn Morris
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-23 17:13 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

On 06/23/2017 09:19 AM, Stefan Monnier wrote:
> Because all the lm-* thingies use leading spaces to distinguish line
> continuations (along the same lines as what RFC822 does).
> It doesn't look weird to me at all.

It's readable either way; all I was saying is that it's weird for 
lm-verify to insist on extra indentation for the second line of a 
copyright notice. The extra indentation isn't that common a style. For 
example, src/emacs.c doesn't use it, nor does src/lisp.h, or 
lisp/subr.el, or lots of other Emacs source files. So why insist on the 
style for lisp/mh-e/mh-e.el?




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

* Re: lm-verify, long copyright line
  2017-06-23 17:13             ` Paul Eggert
@ 2017-06-23 17:59               ` Glenn Morris
  2017-06-23 18:33                 ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Glenn Morris @ 2017-06-23 17:59 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Stefan Monnier, emacs-devel

Paul Eggert wrote:

> The extra indentation isn't that common a style. For example,
> src/emacs.c doesn't use it, nor does src/lisp.h, or lisp/subr.el, or
> lots of other Emacs source files. 

Emacs source files used it in the past, but the nicer formatting was
lost when gnulib's update-copyright began to be used.
Presumably no-one has run lm-verify since then.

I quibbled at the time! :)

http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00887.html



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

* Re: lm-verify, long copyright line
  2017-06-23 17:59               ` Glenn Morris
@ 2017-06-23 18:33                 ` Paul Eggert
  2017-06-24 22:16                   ` Mike Kupfer
  0 siblings, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-23 18:33 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Stefan Monnier, emacs-devel

On 06/23/2017 10:59 AM, Glenn Morris wrote:
> Emacs source files used it in the past, but the nicer formatting was
> lost when gnulib's update-copyright began to be used.
> Presumably no-one has run lm-verify since then.

OK, thanks for explaining. The 2013 discussion didn't mention lm-verify 
and so I didn't worry about the indenting change back then. It is an 
annoyance, and I suppose someone should change either lm-verify or 
Gnulib to fix the incompatibility between the two approaches.




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

* Re: lm-verify, long copyright line
  2017-06-23 18:33                 ` Paul Eggert
@ 2017-06-24 22:16                   ` Mike Kupfer
  2017-06-25  2:01                     ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Kupfer @ 2017-06-24 22:16 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

Paul Eggert wrote:

> I suppose someone should change either
> lm-verify or Gnulib to fix the incompatibility between the two
> approaches.

The change to Gnulib is a one-liner:

--- update-copyright~	2017-06-22 17:16:28.604027480 -0700
+++ update-copyright	2017-06-24 15:08:43.626795139 -0700
@@ -243,7 +243,7 @@
                 || ($stmt =~ s/^([\S]+)(?: |$)//))
               {
                 my $line = $1;
-                $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
+                $stmt_wrapped .= $stmt_wrapped ? "$eol$prefix  " : $leading;
                 $stmt_wrapped .= $line;
               }
             else

I guess the question is how likely would this be to introduce a new set
of problems.

mike



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

* Re: lm-verify, long copyright line
  2017-06-24 22:16                   ` Mike Kupfer
@ 2017-06-25  2:01                     ` Paul Eggert
  2017-06-25  2:59                       ` Mike Kupfer
  2017-06-25 15:10                       ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Paul Eggert @ 2017-06-25  2:01 UTC (permalink / raw)
  To: Mike Kupfer; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

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

Mike Kupfer wrote:
> I guess the question is how likely would this be to introduce a new set
> of problems.

Reasonably likely, I'd say, as the tradition outside Emacs is to indent 
copyright notices the same as other text. Let's make lm-verify a bit more 
generous about copyright notice format; this is a good thing to do regardless of 
whether we change update-copyright. I installed the attached patch into master; 
does it suffice to solve the problem?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Adjust-lm-verify-to-accept-current-notices.patch --]
[-- Type: text/x-patch; name="0001-Adjust-lm-verify-to-accept-current-notices.patch", Size: 1492 bytes --]

From f587a81c5247e79f75c7ec03f4e97a7dd883167b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 24 Jun 2017 17:54:21 -0700
Subject: [PATCH] Adjust lm-verify to accept current notices

Problem reported by Mike Kupfer in:
http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00512.html
* lisp/emacs-lisp/lisp-mnt.el (lm-crack-copyright):
Do not require later lines in a copyright notice to have more
indentation than earlier lines.
---
 lisp/emacs-lisp/lisp-mnt.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index fc3caf3..a1c5b69 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -326,12 +326,13 @@ lm-crack-copyright
 	  (start (point))
 	  (end (line-end-position)))
       ;; Cope with multi-line copyright `lines'.  Assume the second
-      ;; line is indented (with the same commenting style).
+      ;; line is indented at least as much as the original, with the
+      ;; same commenting style.
       (save-excursion
 	(beginning-of-line 2)
-	(let ((str (concat (match-string-no-properties 1) "[ \t]+")))
+	(let ((str (match-string-no-properties 1)))
 	  (beginning-of-line)
-	  (while (looking-at str)
+	  (while (and (looking-at str) (not (looking-at lm-copyright-prefix)))
 	    (setq end (line-end-position))
 	    (beginning-of-line 2))))
       ;; Make a single line and parse that.
-- 
2.7.4


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

* Re: lm-verify, long copyright line
  2017-06-25  2:01                     ` Paul Eggert
@ 2017-06-25  2:59                       ` Mike Kupfer
  2017-06-25 15:10                       ` Stefan Monnier
  1 sibling, 0 replies; 18+ messages in thread
From: Mike Kupfer @ 2017-06-25  2:59 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

Paul Eggert wrote:

> I installed the attached patch into master; does it suffice to solve
> the problem?

Yes, lm-verify no longer complains about

;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2017 Free
;; Software Foundation, Inc.

Thanks!

mike



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

* Re: lm-verify, long copyright line
  2017-06-25  2:01                     ` Paul Eggert
  2017-06-25  2:59                       ` Mike Kupfer
@ 2017-06-25 15:10                       ` Stefan Monnier
  2017-06-25 16:59                         ` Mike Kupfer
  2017-06-25 20:45                         ` Paul Eggert
  1 sibling, 2 replies; 18+ messages in thread
From: Stefan Monnier @ 2017-06-25 15:10 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Glenn Morris, emacs-devel, Mike Kupfer

> Reasonably likely, I'd say, as the tradition outside Emacs is to indent
> copyright notices the same as other text. Let's make lm-verify a bit more
> generous about copyright notice format; this is a good thing to do
> regardless of whether we change update-copyright. I installed the attached
> patch into master; does it suffice to solve the problem?

I think the patch is OK.
But I'd still much prefer the continuation lines to be indented.


        Stefan



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

* Re: lm-verify, long copyright line
  2017-06-25 15:10                       ` Stefan Monnier
@ 2017-06-25 16:59                         ` Mike Kupfer
  2017-06-25 20:45                         ` Paul Eggert
  1 sibling, 0 replies; 18+ messages in thread
From: Mike Kupfer @ 2017-06-25 16:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Glenn Morris, Paul Eggert, emacs-devel

Stefan Monnier wrote:

> But I'd still much prefer the continuation lines to be indented.

This could be achieved by changing the Gnulib update-copyright (the one
in build-aux) to optionally indent.  Control could be via a command-line
flag or an environment variable, which admin/update-copyright could
set.

mike



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

* Re: lm-verify, long copyright line
  2017-06-25 15:10                       ` Stefan Monnier
  2017-06-25 16:59                         ` Mike Kupfer
@ 2017-06-25 20:45                         ` Paul Eggert
  2017-06-25 20:53                           ` Mike Kupfer
  1 sibling, 1 reply; 18+ messages in thread
From: Paul Eggert @ 2017-06-25 20:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Glenn Morris, emacs-devel, Mike Kupfer

Stefan Monnier wrote:
> I'd still much prefer the continuation lines to be indented.

I looked into do that, and it's a bit of a pain. Mike's patch is not quite 
right, since it causes update-copyright to generate lines like this:

-   Copyright (C) 2002, 2004-2007, 2009-2017 Free Software Foundation,
-     Inc.

instead of like this:

+   Copyright (C) 2002, 2004-2007, 2009-2017 Free Software Foundation, Inc.

I guess because update-copyright mistakenly counts the continuation indent as 
being part of the previous line when deciding whether to wrap. No doubt this 
could be fixed, but there's a worse problem: the patch affects all files, even 
those shared with Gnulib where it's better to avoid spurious changes. I suppose 
we could start maintaining a list of the dozens of files imported from Gnulib 
and/or elsewhere (currently we do not have such a list) and having 
update-copyright skip files in that list, but this sounds like quite a bit of 
hassle merely to support a preferred style of indentation for copyright notices.



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

* Re: lm-verify, long copyright line
  2017-06-25 20:45                         ` Paul Eggert
@ 2017-06-25 20:53                           ` Mike Kupfer
  2017-06-25 21:05                             ` Paul Eggert
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Kupfer @ 2017-06-25 20:53 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

Paul Eggert wrote:

> Stefan Monnier wrote:
> > I'd still much prefer the continuation lines to be indented.
> 
> I looked into do that, and it's a bit of a pain. Mike's patch is not
> quite right, since it causes update-copyright to generate lines like
> this:
> 
> -   Copyright (C) 2002, 2004-2007, 2009-2017 Free Software Foundation,
> -     Inc.
> 
> instead of like this:
> 
> +   Copyright (C) 2002, 2004-2007, 2009-2017 Free Software Foundation, Inc.

I don't understand why the second form is correct, given that
update-copyright has this comment:

#   1. Fit within 72 columns.

mike



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

* Re: lm-verify, long copyright line
  2017-06-25 20:53                           ` Mike Kupfer
@ 2017-06-25 21:05                             ` Paul Eggert
  0 siblings, 0 replies; 18+ messages in thread
From: Paul Eggert @ 2017-06-25 21:05 UTC (permalink / raw)
  To: Mike Kupfer; +Cc: Glenn Morris, Stefan Monnier, emacs-devel

Mike Kupfer wrote:
> I don't understand why the second form is correct, given that
> update-copyright has this comment:
> 
> #   1. Fit within 72 columns.

Ah, sorry, I misinterpreted the output of my tests. You're right, this was not 
an issue with the change. The main problem is the style clash between Emacs's 
own files and files imported from elsewhere.



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

end of thread, other threads:[~2017-06-25 21:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 22:51 lm-verify, long copyright line Mike Kupfer
2017-06-22 23:26 ` Paul Eggert
2017-06-22 23:57   ` Mike Kupfer
2017-06-23  0:07     ` Paul Eggert
2017-06-23  0:28       ` Mike Kupfer
2017-06-23  4:18         ` Paul Eggert
2017-06-23 16:19           ` Stefan Monnier
2017-06-23 17:13             ` Paul Eggert
2017-06-23 17:59               ` Glenn Morris
2017-06-23 18:33                 ` Paul Eggert
2017-06-24 22:16                   ` Mike Kupfer
2017-06-25  2:01                     ` Paul Eggert
2017-06-25  2:59                       ` Mike Kupfer
2017-06-25 15:10                       ` Stefan Monnier
2017-06-25 16:59                         ` Mike Kupfer
2017-06-25 20:45                         ` Paul Eggert
2017-06-25 20:53                           ` Mike Kupfer
2017-06-25 21:05                             ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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