diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-06-30 21:49:35 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-06-30 21:49:35 -0400 |
commit | 7891768a52c0f3e803cbde829e935cf7c4ea56bb (patch) | |
tree | eaee8473bd319d5ee400caec85ebd71644f20234 | |
parent | d1859154e80c06964c6786f76a35b3fab0139156 (diff) | |
download | emacs.d-7891768a52c0f3e803cbde829e935cf7c4ea56bb.tar.gz |
Add magit-cherry-toggle-upstream-section command
-rw-r--r-- | init.el | 3 | ||||
-rw-r--r-- | lisp/km-magit.el | 19 |
2 files changed, 22 insertions, 0 deletions
@@ -1000,6 +1000,9 @@ (define-key magit-revision-mode-map (kbd "C-c C-r") #'km/magit-revision-insert-related-refs) + (define-key magit-cherry-mode-map "u" + #'km/magit-cherry-toggle-upstream-section) + (bind-keys :map km/magit-map ("c" . km/magit-find-commit-file) ("g" . km/git-map) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 9455237..d4b89f2 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -594,6 +594,25 @@ show tags by default." ((derived-mode-p 'magit-cherry-mode) (call-interactively #'km/magit-cherry-flip-revs)))) +(defun km/magit-cherry-insert-in-upstream () + (insert ?\n) + (magit-insert-section (cherries) + (magit-insert-heading "In upstream:") + (magit-git-wash (apply-partially 'magit-log-wash-log 'cherry) + "cherry" "-v" "--abbrev" + (nth 1 magit-refresh-args) (nth 0 magit-refresh-args)))) + +(defun km/magit-cherry-toggle-upstream-section () + (interactive) + (let ((pos (point))) + (if (memq #'km/magit-cherry-insert-in-upstream magit-cherry-sections-hook) + (kill-local-variable 'magit-cherry-sections-hook) + (setq-local magit-cherry-sections-hook + (append magit-cherry-sections-hook + '(km/magit-cherry-insert-in-upstream)))) + (magit-refresh-buffer) + (goto-char pos))) + (defun km/magit-diff-visit-file (&optional prev-rev other-window) "Like `magit-diff-visit-file', but with the option to visit REV^. |