From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2BA96139695 for ; Sun, 5 Mar 2017 17:51:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4CCC221C04E; Sun, 5 Mar 2017 17:51:46 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 282D321C03E for ; Sun, 5 Mar 2017 17:51:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1C86A34176A for ; Sun, 5 Mar 2017 17:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id ABE955D76 for ; Sun, 5 Mar 2017 17:51:43 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1488656253.1cd9d5a0a702d5b52361e7d4b6c504478f38569f.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:ebuild-mode commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: ChangeLog ebuild-mode.el X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 1cd9d5a0a702d5b52361e7d4b6c504478f38569f X-VCS-Branch: ebuild-mode Date: Sun, 5 Mar 2017 17:51:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c242dbfe-3d72-4166-97ff-b098a61d60fe X-Archives-Hash: 1e6ee6edb8dae7de6008d43fffcc8501 commit: 1cd9d5a0a702d5b52361e7d4b6c504478f38569f Author: Ulrich Müller gentoo org> AuthorDate: Sat Mar 4 19:37:33 2017 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Sat Mar 4 19:37:33 2017 +0000 URL: https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=1cd9d5a0 Modify the buffer only if the ebuild header is actually updated. * ebuild-mode.el (ebuild-mode-update-copyright): Modify the buffer only if necessary. Warn about equal first and last year. ChangeLog | 5 +++++ ebuild-mode.el | 18 ++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index afff130..4f8877b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-03-04 Ulrich Müller + + * ebuild-mode.el (ebuild-mode-update-copyright): Modify the buffer + only if necessary. Warn about equal first and last year. + 2017-02-28 Ulrich Müller * Version 1.33 released. diff --git a/ebuild-mode.el b/ebuild-mode.el index a880e2b..b11b5d9 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -254,16 +254,14 @@ Optional argument LIMIT restarts collection after that number of elements." (goto-char (point-min)) (let ((case-fold-search nil)) (if (re-search-forward ebuild-mode-copyright-regexp 400 t) - (let ((first-year (string-to-number (match-string 1))) - (last-year (string-to-number (match-string 2))) - (this-year-string (format-time-string "%Y"))) - (if (and (<= 1999 first-year) ; only 2 args in GNU Emacs 23 - (<= first-year last-year) - (<= last-year (string-to-number this-year-string))) - (replace-match this-year-string t t nil 2) - (lwarn 'ebuild-mode :warning - "Suspicious range of copyright years: %d-%d" - first-year last-year))))))) + (let* ((y1 (string-to-number (match-string 1))) + (y2 (string-to-number (match-string 2))) + (year (format-time-string "%Y")) + (y (string-to-number year))) + (if (or (> 1999 y1) (>= y1 y2) (> y2 y)) + (lwarn 'ebuild-mode :warning + "Suspicious range of copyright years: %d-%d" y1 y2) + (if (/= y2 y) (replace-match year t t nil 2)))))))) (defun ebuild-mode-delete-cvs-line () ;; Remove a CVS $Id$ or $Header$ line