[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 9e95c23813 1/7: Use `and' instead of `when' or
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 9e95c23813 1/7: Use `and' instead of `when' or `unless' if value matters |
Date: |
Mon, 31 Jul 2023 13:00:09 -0400 (EDT) |
branch: elpa/git-commit
commit 9e95c2381375cb064d54a6afe70d61140da6fa30
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Use `and' instead of `when' or `unless' if value matters
---
lisp/git-commit.el | 13 +++++++------
lisp/magit-git.el | 17 ++++++++++-------
lisp/magit-log.el | 4 ++--
lisp/magit-section.el | 6 +++---
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index a22a3e785e..b11141a31c 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -791,12 +791,13 @@ Save current message first."
(unless (eq (char-before) ?\n)
(insert ?\n))
(setq str (buffer-string)))
- (unless (string-match "\\`[ \t\n\r]*\\'" str)
- (when (string-match "\\`\n\\{2,\\}" str)
- (setq str (replace-match "\n" t t str)))
- (when (string-match "\n\\{2,\\}\\'" str)
- (setq str (replace-match "\n" t t str)))
- str)))
+ (and (not (string-match "\\`[ \t\n\r]*\\'" str))
+ (progn
+ (when (string-match "\\`\n\\{2,\\}" str)
+ (setq str (replace-match "\n" t t str)))
+ (when (string-match "\n\\{2,\\}\\'" str)
+ (setq str (replace-match "\n" t t str)))
+ str))))
;;; Utilities
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index cfff36543b..778f6d1551 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1087,7 +1087,9 @@ tracked file."
(magit-list-files "--cached"))
(defun magit-untracked-files (&optional all files)
- (magit-list-files "--other" (unless all "--exclude-standard") "--" files))
+ (magit-list-files "--other"
+ (and (not all) "--exclude-standard")
+ "--" files))
(defun magit-modified-files (&optional nomodules files)
(magit-git-items "diff-index" "-z" "--name-only"
@@ -1788,14 +1790,15 @@ according to the branch type."
(defun magit-get-@{push}-branch (&optional branch)
(let ((ref (magit-rev-parse "--symbolic-full-name"
(concat branch "@{push}"))))
- (when (and ref (string-prefix-p "refs/remotes/" ref))
- (substring ref 13))))
+ (and ref
+ (string-prefix-p "refs/remotes/" ref)
+ (substring ref 13))))
(defun magit-get-remote (&optional branch)
- (when (or branch (setq branch (magit-get-current-branch)))
- (let ((remote (magit-get "branch" branch "remote")))
- (unless (equal remote ".")
- remote))))
+ (and (or branch (setq branch (magit-get-current-branch)))
+ (let ((remote (magit-get "branch" branch "remote")))
+ (and (not (equal remote "."))
+ remote))))
(defun magit-get-some-remote (&optional branch)
(or (magit-get-remote branch)
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 81164a2828..130fa4015d 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -619,8 +619,8 @@ commits before and half after."
(magit-list-refnames nil t)
nil nil nil 'magit-revision-history
(or (magit-branch-or-commit-at-point)
- (unless use-current
- (magit-get-previous-branch)))
+ (and (not use-current)
+ (magit-get-previous-branch)))
nil t)
"[, ]" t))))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 1a04b55f54..fd2fd5c0e1 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1346,9 +1346,9 @@ anything this time around.
(magit-insert-section--parent ,s)
(magit-insert-section--oldroot
(or magit-insert-section--oldroot
- (unless magit-insert-section--parent
- (prog1 magit-root-section
- (setq magit-root-section ,s))))))
+ (and (not magit-insert-section--parent)
+ (prog1 magit-root-section
+ (setq magit-root-section ,s))))))
(catch 'cancel-section
,@(if s*
`((let ((,s* ,s))
- [nongnu] elpa/git-commit updated (95d5be9ac3 -> 6d300bfe36), ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 4ca7b95f28 3/7: magit-diff-type: Fix in logs when section isn't provided as argument, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit e8152c76bf 5/7: Use if-let instead of --if-let, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 9f403b68e8 4/7: Use when-let instead of --when-let, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 9e95c23813 1/7: Use `and' instead of `when' or `unless' if value matters,
ELPA Syncer <=
- [nongnu] elpa/git-commit 41a0f6ed30 2/7: Use and-let* instead of when-let* if value matters, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 70843f133c 6/7: Fix switch from -replace to cl-substitute, ELPA Syncer, 2023/07/31
- [nongnu] elpa/git-commit 6d300bfe36 7/7: Explicitly depend on latest Seq release for older Emacs releases, ELPA Syncer, 2023/07/31