From d8429412cacfd0613347c7d8d3beb365a967846d Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Wed, 3 Jul 2024 18:41:10 +0200 Subject: Replace nested ifs with cond MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ebuild-mode.el (ebuild-mode-update-copyright): Replace nested ifs with cond. Signed-off-by: Ulrich Müller --- ChangeLog | 5 +++++ ebuild-mode.el | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7718810..b7bdc28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-07-03 Ulrich Müller + + * ebuild-mode.el (ebuild-mode-update-copyright): Replace nested + ifs with cond. + 2024-06-29 Ulrich Müller * Version 1.72 released. diff --git a/ebuild-mode.el b/ebuild-mode.el index 3e057e0..aa63cbc 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -382,18 +382,19 @@ Compatibility function for XEmacs." (y (string-to-number year))) (if y2 ;; Update range of years - (if (or (> 1999 y1) (>= y1 y2) (> y2 y)) - ;; XEmacs wants 'warning instead of :warning, - ;; but nil always works (and defaults to :warning) - (lwarn 'ebuild nil - "Suspicious range of copyright years: %d-%d" y1 y2) - (if (/= y2 y) - (replace-match year t t nil 2))) + (cond ((or (> 1999 y1) (>= y1 y2) (> y2 y)) + ;; XEmacs wants 'warning instead of :warning, + ;; but nil always works (and defaults to :warning) + (lwarn 'ebuild nil + "Suspicious range of copyright years: %d-%d" + y1 y2)) + ((/= y2 y) + (replace-match year t t nil 2))) ;; Update single year and convert to range if necessary - (if (or (> 1999 y1) (> y1 y)) - (lwarn 'ebuild nil "Suspicious copyright year: %d" y1) - (if (/= y1 y) - (replace-match (concat "\\1-" year) t nil nil 1)))))) + (cond ((or (> 1999 y1) (> y1 y)) + (lwarn 'ebuild nil "Suspicious copyright year: %d" y1)) + ((/= y1 y) + (replace-match (concat "\\1-" year) t nil nil 1)))))) (if update-author ;; Update default author in copyright notice (if (string-equal (match-string 3) "Gentoo Foundation") -- cgit v1.2.3-65-gdbad