branch: elpa/magit
commit 26d0d82b11688c91f361c0a19c194ac633a795cb
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-log-move-to-parent: Reduce nesting
---
lisp/magit-log.el | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 3663125f491..3b39a6ebdc9 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -937,20 +937,20 @@ is displayed in the current frame."
(defun magit-log-move-to-parent (&optional n)
"Move to the Nth parent of the current commit."
(interactive "p")
- (when (derived-mode-p 'magit-log-mode)
- (when (magit-section-match 'commit)
- (let* ((section (magit-current-section))
- (parent-rev (format "%s^%s" (oref section value) (or n 1))))
- (if-let ((parent-hash (magit-rev-parse "--short" parent-rev)))
- (if-let ((parent (--first (equal (oref it value)
- parent-hash)
- (magit-section-siblings section 'next))))
- (magit-section-goto parent)
- (user-error
- (substitute-command-keys
- (concat "Parent " parent-hash " not found. Try typing "
- "\\[magit-log-double-commit-limit] first"))))
- (user-error "Parent %s does not exist" parent-rev))))))
+ (when (and (derived-mode-p 'magit-log-mode)
+ (magit-section-match 'commit))
+ (let* ((section (magit-current-section))
+ (parent-rev (format "%s^%s" (oref section value) (or n 1))))
+ (if-let ((parent-hash (magit-rev-parse "--short" parent-rev)))
+ (if-let ((parent (--first (equal (oref it value)
+ parent-hash)
+ (magit-section-siblings section 'next))))
+ (magit-section-goto parent)
+ (user-error
+ (substitute-command-keys
+ (concat "Parent " parent-hash " not found. Try typing "
+ "\\[magit-log-double-commit-limit] first"))))
+ (user-error "Parent %s does not exist" parent-rev)))))
(defun magit-log-move-to-revision (rev)
"Read a revision and move to it in current log buffer.