[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa-admin ae66216 267/439: [admin int] Replace one-armed-‘if’
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa-admin ae66216 267/439: [admin int] Replace one-armed-‘if’ w/ either ‘when’ or ‘and’. |
Date: |
Sun, 17 Oct 2021 15:48:17 -0400 (EDT) |
branch: elpa-admin
commit ae662161f1fd974928a1bffff0305df05d7558ed
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[admin int] Replace one-armed-‘if’ w/ either ‘when’ or ‘and’.
One-armed-‘if’ is considered poor style in some circles.
We use ‘when’ when the value is discarded, ‘and’ otherwise.
* admin/archive-contents.el (batch-make-archive): Use ‘when’.
(archive-prepare-packages, archive--make-changelog): Likewise.
(archive--metadata): Use ‘and’.
---
admin/archive-contents.el | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 7ec415c..e4db805 100755
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -66,8 +66,8 @@ Delete backup files also."
(let* ((pkg (file-name-nondirectory dir))
(autoloads-file (expand-file-name (concat pkg
"-autoloads.el") dir)))
;; Omit autoloads and .elc files from the package.
- (if (file-exists-p autoloads-file)
- (delete-file autoloads-file))
+ (when (file-exists-p autoloads-file)
+ (delete-file autoloads-file))
(archive--delete-elc-files dir)
(let ((metadata (or (with-demoted-errors
;;(format "batch-make-archive %s: %%s" dir)
@@ -85,8 +85,8 @@ Delete backup files also."
(push (if (car metadata)
(apply #'archive--process-simple-package
dir pkg (cdr metadata))
- (if (nth 1 metadata)
- (archive--write-pkg-file dir pkg metadata))
+ (when (nth 1 metadata)
+ (archive--write-pkg-file dir pkg metadata))
(archive--process-multi-file-package dir pkg))
packages)))))
((debug error) (error "Error in %s: %S" dir v))))
@@ -137,9 +137,9 @@ Currently only refreshes the ChangeLog files."
(let ((default-directory (expand-file-name "packages/")))
(dolist (pkg pkgs)
(condition-case v
- (if (file-directory-p pkg)
- (archive--make-changelog pkg (expand-file-name "packages/"
- srcdir)))
+ (when (file-directory-p pkg)
+ (archive--make-changelog pkg (expand-file-name "packages/"
+ srcdir)))
(error (message "Error: %S" v)))))
(write-region new-revno nil wit nil 'quiet)
;; Also update the ChangeLog of external packages.
@@ -196,9 +196,9 @@ PKG is the name of the package and DIR is the directory
where it is."
(url (or (lm-header "url")
(format archive-default-url-format pkg)))
(req
- (if requires-str
- (mapcar 'archive--convert-require
- (car (read-from-string requires-str))))))
+ (and requires-str
+ (mapcar 'archive--convert-require
+ (car (read-from-string requires-str))))))
(list simple version description req
;; extra parameters
(list (cons :url url)
@@ -245,7 +245,7 @@ Rename DIR/PKG.el to PKG-VERS.el, delete DIR, and return
the descriptor."
(set-buffer-multibyte nil)
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary))
- (if (file-readable-p "ChangeLog") (insert-file-contents "ChangeLog"))
+ (when (file-readable-p "ChangeLog") (insert-file-contents "ChangeLog"))
(let ((old-md5 (md5 (current-buffer))))
(erase-buffer)
(let ((default-directory
- [nongnu] elpa-admin 7ce78d5 071/439: Note that 'autogen.sh' should be run to generate 'configure' and 'Makefile.in' (see #11), (continued)
- [nongnu] elpa-admin 7ce78d5 071/439: Note that 'autogen.sh' should be run to generate 'configure' and 'Makefile.in' (see #11), Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin a745b29 076/439: * admin/archive-contents.el: Create web pages., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 1daf0bb 085/439: Merge branch 'master' of github.com:rocky/emacs-loc-changes, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin e71d997 087/439: Merge remote-tracking branch 'repo.or.cz/elpa', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin cd01c51 080/439: Remove the angle brackets, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 30c8a11 248/439: Merge commit '5f47b1f64cad8a06e945e2a1287b986a3676554d', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 299da86 255/439: Package pages improvements, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 5067b05 258/439: Change to package directory before checking .elpaignore exclusions., Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin ec13cc2 260/439: Let ert-support.el work for subdirectories, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 8ee4770 264/439: [admin int] Add abstraction: archive--form-from-file-contents, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin ae66216 267/439: [admin int] Replace one-armed-‘if’ w/ either ‘when’ or ‘and’.,
Philip Kaludercic <=
- [nongnu] elpa-admin a23a8b8 271/439: Merge branch 'scratch/hook-helpers', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 334aa51 273/439: Merge commit 'a1130df3ada34e76675324a8c25823b420b20239', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin cb72492 279/439: Merge branch 'ebdb-bits', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin c60a3bb 280/439: Merge branch 'scratch/which-key', Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 8154769 282/439: * copyright_exceptions: Update for new uni-confusables/gen-confusables.el, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 280353e 287/439: Merge commit 'cb905bdc728fb3b5f9fdff8836d71b62bd717eab' from mmm-mode, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin aa346f0 290/439: * GNUmakefile (org-fetch): Use https and stick to wget, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 84f67ae 294/439: * admin/archive-contents.el (archive--insert-repolinks): Fix last change, Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 0c23652 046/439: Revert "Add an explicit OPERATION-MODE "nil" in README's examples", Philip Kaludercic, 2021/10/17
- [nongnu] elpa-admin 99b8d94 054/439: admin/archive-contents.el (batch-make-archive, archive--process-simple-package): Use write-region, Philip Kaludercic, 2021/10/17