Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/emacs-tools:ebuild-mode commit in: /
Date: Sun, 05 Mar 2017 17:51:48
Message-Id: 1488656253.1cd9d5a0a702d5b52361e7d4b6c504478f38569f.ulm@gentoo
1 commit: 1cd9d5a0a702d5b52361e7d4b6c504478f38569f
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 4 19:37:33 2017 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 4 19:37:33 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=1cd9d5a0
7
8 Modify the buffer only if the ebuild header is actually updated.
9
10 * ebuild-mode.el (ebuild-mode-update-copyright): Modify the buffer
11 only if necessary. Warn about equal first and last year.
12
13 ChangeLog | 5 +++++
14 ebuild-mode.el | 18 ++++++++----------
15 2 files changed, 13 insertions(+), 10 deletions(-)
16
17 diff --git a/ChangeLog b/ChangeLog
18 index afff130..4f8877b 100644
19 --- a/ChangeLog
20 +++ b/ChangeLog
21 @@ -1,3 +1,8 @@
22 +2017-03-04 Ulrich Müller <ulm@g.o>
23 +
24 + * ebuild-mode.el (ebuild-mode-update-copyright): Modify the buffer
25 + only if necessary. Warn about equal first and last year.
26 +
27 2017-02-28 Ulrich Müller <ulm@g.o>
28
29 * Version 1.33 released.
30
31 diff --git a/ebuild-mode.el b/ebuild-mode.el
32 index a880e2b..b11b5d9 100644
33 --- a/ebuild-mode.el
34 +++ b/ebuild-mode.el
35 @@ -254,16 +254,14 @@ Optional argument LIMIT restarts collection after that number of elements."
36 (goto-char (point-min))
37 (let ((case-fold-search nil))
38 (if (re-search-forward ebuild-mode-copyright-regexp 400 t)
39 - (let ((first-year (string-to-number (match-string 1)))
40 - (last-year (string-to-number (match-string 2)))
41 - (this-year-string (format-time-string "%Y")))
42 - (if (and (<= 1999 first-year) ; only 2 args in GNU Emacs 23
43 - (<= first-year last-year)
44 - (<= last-year (string-to-number this-year-string)))
45 - (replace-match this-year-string t t nil 2)
46 - (lwarn 'ebuild-mode :warning
47 - "Suspicious range of copyright years: %d-%d"
48 - first-year last-year)))))))
49 + (let* ((y1 (string-to-number (match-string 1)))
50 + (y2 (string-to-number (match-string 2)))
51 + (year (format-time-string "%Y"))
52 + (y (string-to-number year)))
53 + (if (or (> 1999 y1) (>= y1 y2) (> y2 y))
54 + (lwarn 'ebuild-mode :warning
55 + "Suspicious range of copyright years: %d-%d" y1 y2)
56 + (if (/= y2 y) (replace-match year t t nil 2))))))))
57
58 (defun ebuild-mode-delete-cvs-line ()
59 ;; Remove a CVS $Id$ or $Header$ line