summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-06-24 01:27:48 +0100
committerjao <jao@gnu.org>2021-06-24 01:27:48 +0100
commitb405f4f3b3c73f8f4caebab94ff8c8a21ec933a7 (patch)
treed0829ea1ee82beed13b431e67f04862bf4c66416
parent4d7e33eed8582c30cd3ec8f0a112490fb6c3cede (diff)
downloadelibs-b405f4f3b3c73f8f4caebab94ff8c8a21ec933a7.tar.gz
elibs-b405f4f3b3c73f8f4caebab94ff8c8a21ec933a7.tar.bz2
eldoc for magit buffers
-rw-r--r--init.org28
1 files changed, 28 insertions, 0 deletions
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