From b405f4f3b3c73f8f4caebab94ff8c8a21ec933a7 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 24 Jun 2021 01:27:48 +0100 Subject: eldoc for magit buffers --- init.org | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/init.org b/init.org index 09dce73..ff01bd8 100644 --- a/init.org +++ b/init.org @@ -1985,6 +1985,34 @@ (add-hook 'magit-status-sections-hook #'forge-insert-assigned-issues t) (add-hook 'magit-status-sections-hook #'forge-insert-issues t)) #+end_src +*** Eldoc for magit status/log buffers + [[https://tsdh.org/posts/2021-06-21-using-eldoc-with-magit.html][Using Eldoc with Magit]]. + #+begin_src emacs-lisp + (defun jao-magit-eldoc-for-commit (_callback) + (when-let ((commit (magit-commit-at-point))) + (with-temp-buffer + (magit-git-insert "show" + "--format=format:%an <%ae>, %ar" + (format "--stat=%d" (window-width)) + commit) + (goto-char (point-min)) + (put-text-property (point-min) (line-end-position) 'face 'bold) + (buffer-string)))) + + (defun jao-magit-eldoc-setup () + (add-hook 'eldoc-documentation-functions + #'jao-magit-eldoc-for-commit nil t) + (eldoc-mode 1)) + + (add-hook 'magit-status-mode-hook #'jao-magit-eldoc-setup) + (add-hook 'magit-log-mode-hook #'jao-magit-eldoc-setup) + + (with-eval-after-load "eldoc" + (eldoc-add-command 'magit-next-line) + (eldoc-add-command 'magit-previous-line) + (eldoc-add-command 'magit-section-forward) + (eldoc-add-command 'magit-section-backward)) + #+end_src *** Other git packages #+begin_src emacs-lisp (use-package git-messenger -- cgit v1.2.3