branch: elpa/magit commit 5282c977bcfcffaf7a0726ae3455369a18831aae Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-blob-{previous,next}: Add suffix predicates --- lisp/magit-files.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/magit-files.el b/lisp/magit-files.el index 40535417194..7f6a73e3185 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -377,8 +377,9 @@ in a single window." (interactive) (kill-buffer)) -(defun magit-blob-next () +(transient-define-suffix magit-blob-next () "Visit the next blob which modified the current file." + :inapt-if-nil 'magit-buffer-file-name (interactive) (cond-let [[rev (or magit-buffer-revision "{worktree}")] @@ -389,8 +390,10 @@ in a single window." (apply #'magit-blob-visit next)) ((user-error "You have reached the end of time")))) -(defun magit-blob-previous () +(transient-define-suffix magit-blob-previous () "Visit the previous blob which modified the current file." + :inapt-if-not (##and$ (magit-buffer-file-name) + (magit-blob-ancestor (magit-buffer-revision) $)) (interactive) (cond-let [[rev (or magit-buffer-revision "{worktree}")]