branch: elpa/git-commit
commit cc07643bb1d81e8eb3fe4adcf60d24f9de2ba009
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
Use fboundp instead of declare-function for magit-blame functions
This helps avoiding circular dependencies.
---
lisp/magit-diff.el | 3 ++-
lisp/magit-git.el | 10 ++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 9e78b52923..1687ef1382 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1803,7 +1803,8 @@ commit or stash at point, then prompt for a commit."
(defun magit-diff-show-or-scroll (fn)
(let (rev cmd buf win)
(cond
- (magit-blame-mode
+ ((and (bound-and-true-p magit-blame-mode)
+ (fboundp 'magit-current-blame-chunk))
(setq rev (oref (magit-current-blame-chunk) orig-rev))
(setq cmd #'magit-show-commit)
(setq buf (magit-get-mode-buffer 'magit-revision-mode)))
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 80879b2ab7..341167f3d1 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -59,10 +59,6 @@
(defvar magit-this-error)
(defvar magit-process-error-message-regexps)
-;; From `magit-blame'.
-(declare-function magit-current-blame-chunk "magit-blame"
- (&optional type noerror))
-
(eval-when-compile
(cl-pushnew 'orig-rev eieio--known-slot-names)
(cl-pushnew 'number eieio--known-slot-names))
@@ -1507,7 +1503,8 @@ to, or to some other symbolic-ref that points to the same
ref."
(defun magit-commit-at-point ()
(or (magit-section-value-if 'commit)
(magit-thing-at-point 'git-revision t)
- (and-let* ((chunk (magit-current-blame-chunk 'addition t)))
+ (and-let* ((chunk (and (fboundp 'magit-current-blame-chunk)
+ (magit-current-blame-chunk 'addition t))))
(oref chunk orig-rev))
(and (derived-mode-p 'magit-stash-mode
'magit-merge-preview-mode
@@ -1527,7 +1524,8 @@ to, or to some other symbolic-ref that points to the same
ref."
(magit-ref-p (format "refs/pullreqs/%s"
(oref (oref it value) number))))))
(magit-thing-at-point 'git-revision t)
- (and-let* ((chunk (magit-current-blame-chunk 'addition t)))
+ (and-let* ((chunk (and (fboundp 'magit-current-blame-chunk)
+ (magit-current-blame-chunk 'addition t))))
(oref chunk orig-rev))
(and magit-buffer-file-name
magit-buffer-refname)