aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-git.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-08-22 20:55:30 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-08-22 20:55:30 +0200
commitda52ac901247b12241504e9baf89275c13b41def (patch)
tree97664ce6735c0606660dfe88647a7d046546e840 /lisp/magit-git.el
parent7de0f1335f8c4954d6d07413c5ec19fc8200078c (diff)
Revert "Remove kludge for and-let* bug in older Emacs releases"
This reverts commit 92020002b3f162e26af11f1a01c21bb18111b1cc. These `progn' used to be necessary because `and-let*' used to behave like `if'. That bug was fixed in Emacs 27.1 -- since then it behaves like `when', as its author intended. However, going forward we will use the `and-let*' implementation from the `cond-let' package and that takes a single BODYFORM. Sometimes it would be convenient if it supported multiple BODY forms and they behaved like those were wrapped with `progn' and other times like they were wrapped with `and', and we could determine which would be useful more often and the optimize for that. Requiring an explicit `and' or `progn' is better, especially when the author is forced to call out the fact that there *also* is a side-effect.
Diffstat (limited to 'lisp/magit-git.el')
-rw-r--r--lisp/magit-git.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 60d6a59..09537e8 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1494,10 +1494,11 @@ Git."
(defun magit-name-tag (rev &optional lax)
(and-let* ((name (magit-rev-name rev "refs/tags/*")))
- (when (string-suffix-p "^0" name)
- (setq name (substring name 0 -2)))
- (and (or lax (not (string-match-p "[~^]" name)))
- (substring name 5))))
+ (progn
+ (when (string-suffix-p "^0" name)
+ (setq name (substring name 0 -2)))
+ (and (or lax (not (string-match-p "[~^]" name)))
+ (substring name 5)))))
(defun magit-ref-abbrev (refname)
"Return an unambiguous abbreviation of REFNAME."
@@ -2337,8 +2338,9 @@ If `first-parent' is set, traverse only first parents."
(defun magit-format-rev-summary (rev)
(and-let* ((str (magit-rev-format "%h %s" rev)))
- (magit--put-face 0 (string-match " " str) 'magit-hash str)
- str))
+ (progn
+ (magit--put-face 0 (string-match " " str) 'magit-hash str)
+ str)))
(defvar magit-ref-namespaces
'(("\\`HEAD\\'" . magit-head)
@@ -2667,8 +2669,9 @@ and this option only controls what face is used.")
(magit-read-range
prompt
(or (and-let* ((revs (magit-region-values '(commit branch) t)))
- (deactivate-mark)
- (concat (car (last revs)) ".." (car revs)))
+ (progn
+ (deactivate-mark)
+ (concat (car (last revs)) ".." (car revs))))
(magit-branch-or-commit-at-point)
secondary-default
(magit-get-current-branch))))