summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-02-16 00:58:05 -0500
committerKyle Meyer <kyle@kyleam.com>2019-02-16 01:16:47 -0500
commit797591e74c023391796f34f3c6f992ed96873350 (patch)
tree271d64f129f04a7d5e012ba2c6cd4e33d2289452
parentf08b64e634bbec8d861024c3cc1c04189464457a (diff)
downloademacs.d-797591e74c023391796f34f3c6f992ed96873350.tar.gz
magit: Update for transient branch merge
I'm not incredibly confident that I performed a faithful conversion, but the things I've tested seem to be working. Keep the popup configuration around since I still use it for guix.el and snakemake.el.
-rw-r--r--.gitignore1
-rw-r--r--init.el117
-rw-r--r--lisp/km-magit.el10
3 files changed, 60 insertions, 68 deletions
diff --git a/.gitignore b/.gitignore
index 8fce85f..9e551ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@ cache
/eww-bookmarks
/lisp/km-emacs-autoloads.el
/lisp/mail-config.el
+/transient
diff --git a/init.el b/init.el
index 19909bc..909418f 100644
--- a/init.el
+++ b/init.el
@@ -895,6 +895,9 @@
(use-package graphql
:load-path "~/src/emacs/graphql.el/")
+(use-package transient
+ :load-path "~/src/emacs/transient/lisp")
+
(use-package magit-popup
:load-path "~/src/emacs/magit-popup/"
:config
@@ -913,8 +916,8 @@
:init
(load "magit-autoloads.el" t)
(bind-keys :map km/git-map
- ("d" . magit-dispatch-popup)
- ("g" . magit-file-popup)
+ ("d" . magit-dispatch)
+ ("g" . magit-file-dispatch)
("l" . magit-log-buffer-file)
("s" . magit-stage-file))
(define-key km/git-map "w" 'km/magit-wip-map)
@@ -948,8 +951,6 @@
(add-to-list 'magit-blame-disable-modes 'lispy-mode)
- (setq magit-branch-arguments
- (delete "--track" magit-branch-arguments))
(setq magit-branch-popup-show-variables nil)
(setq magit-show-refs-arguments '("--sort=-committerdate"))
@@ -965,11 +966,11 @@
(define-key km/file-map "g" #'magit-find-file)
(bind-keys :map magit-mode-map
- ("o" . magit-push-popup)
+ ("o" . magit-push)
;; Remove `magit-add-change-log-entry-other-window',
;; which overrides my binding for
;; `km/zsh-ansi-term-other-window'.
- ("P" . magit-submodule-popup)
+ ("P" . magit-submodule)
("C-x 4 a" . nil))
(define-key magit-file-section-map (kbd "C-j")
@@ -985,38 +986,26 @@
("n" . magit-diff-toggle-file-filter)
("l" . magit-toggle-buffer-lock))
- (magit-define-popup-action 'magit-diff-popup
- ?e "Edit options" #'magit-diff-refresh-popup)
-
- (magit-define-popup-option 'magit-diff-popup
- ?d "Diff filter" "--diff-filter=")
- (magit-define-popup-option 'magit-diff-mode-refresh-popup
- ?d "Diff filter" "--diff-filter=")
-
- (magit-change-popup-key 'magit-stash-popup :action
- ?Z ?s)
-
- (magit-define-popup-switch 'magit-log-popup
- ?p "First parent" "--first-parent")
- (magit-define-popup-switch 'magit-log-popup
- ?n "No merges" "--no-merges")
+ (transient-append-suffix 'magit-diff "t"
+ '("e" "Edit options" magit-diff-refresh))
+ (transient-append-suffix 'magit-diff "-w"
+ '("-d" "Diff filter" "--diff-filter=" read-from-minibuffer))
+ (transient-append-suffix 'magit-diff-refresh "-w"
+ '("-d" "Diff filter" "--diff-filter=" read-from-minibuffer))
- (magit-define-popup-action 'magit-log-popup
- ?e "Edit options" 'magit-log-refresh-popup)
+ (transient-suffix-put 'magit-stash "Z" :key "s")
- (magit-define-popup-action 'magit-log-refresh-popup
- ?m "Modify range" 'km/magit-log-modify-range)
+ (transient-append-suffix 'magit-log "a"
+ '("e" "Edit options" magit-log-refresh))
+ (transient-append-suffix 'magit-log-refresh "g"
+ '("m" "Modify range" km/magit-log-modify-range))
- (magit-change-popup-key 'magit-branch-popup :action
- ?c ?o)
- (magit-change-popup-key 'magit-branch-popup :action
- ?C ?S)
- (magit-change-popup-key 'magit-branch-popup :action
- ?n ?C)
- (magit-change-popup-key 'magit-branch-popup :action
- ?m ?R)
- (magit-change-popup-key 'magit-branch-popup :action
- ?s ?v)
+ (transient-suffix-put 'magit-branch "c" :key "o")
+ (transient-suffix-put 'magit-branch "C" :key "S")
+ (transient-suffix-put 'magit-branch "n" :key "C")
+ (transient-suffix-put 'magit-branch "r" :key "R")
+ (transient-suffix-put 'magit-branch "m" :key "r")
+ (transient-suffix-put 'magit-branch "s" :key "v")
(advice-add
'magit-generate-buffer-name-default-function
@@ -1144,34 +1133,36 @@
magit-status-sections-hook))
(list #'km/magit-insert-remote-counts)))
- (magit-define-popup-action 'magit-commit-popup
- ?u "Auto commit" #'km/magit-update-or-auto-commit)
-
- (magit-change-popup-key 'magit-push-popup :action
- ?u ?U)
- (magit-change-popup-key 'magit-push-popup :action
- ?p ?P)
-
- (magit-define-popup-action 'magit-log-popup
- ?l "Log current" #'km/magit-log-current)
- (magit-define-popup-action 'magit-log-popup
- ?d "Log dwim" #'km/magit-log-dwim)
- (magit-define-popup-action 'magit-log-popup
- ?y "Cherry dwim" #'km/magit-cherry-dwim)
-
- (magit-define-popup-action 'magit-merge-popup
- ?u "Merge upstream" #'km/magit-ff-merge-upstream)
-
- (magit-define-popup-action 'magit-branch-popup
- ?c "Create & checkout from current"
- #'km/magit-branch-and-checkout-from-current)
-
- (magit-define-popup-action 'magit-branch-popup
- ?m "Checkout master" #'km/magit-checkout-master)
- (magit-define-popup-action 'magit-branch-popup
- ?r "Rename branch" #'km/magit-branch-rename)
- (magit-define-popup-action 'magit-branch-popup
- ?s "Backup current branch" #'km/magit-branch-backup-current))
+ (transient-append-suffix 'magit-commit "c"
+ '("u" "Auto commit" km/magit-update-or-auto-commit))
+
+ (transient-suffix-put 'magit-push "u" :key "U")
+ (transient-suffix-put 'magit-push "p" :key "P")
+
+ (transient-replace-suffix 'magit-log "l"
+ '("l" "Log current" km/magit-log-current))
+
+ (transient-append-suffix 'magit-log "l"
+ '("d" "Log dwim" km/magit-log-dwim))
+
+ (transient-append-suffix 'magit-log "d"
+ '("y" "Cherry dwim" km/magit-cherry-dwim))
+
+ (transient-append-suffix 'magit-merge "m"
+ '("u" "Merge upstream" km/magit-ff-merge-upstream))
+
+ (transient-append-suffix 'magit-branch "b"
+ '("c" "Create & checkout from current"
+ km/magit-branch-and-checkout-from-current))
+
+ (transient-replace-suffix 'magit-branch "r"
+ '("r" "Rename branch" km/magit-branch-rename))
+
+ (transient-append-suffix 'magit-branch "r"
+ '("s" "Backup current branch" km/magit-branch-backup-current))
+
+ (transient-append-suffix 'magit-branch "c"
+ '("m" "Checkout master" km/magit-checkout-master)))
(use-package magit-annex
:load-path "~/src/emacs/magit-annex/"
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 9603171..fcb3809 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -121,7 +121,7 @@ branch."
\n(git merge --no-edit --ff-only <upstream>)"
(interactive)
(--if-let (magit-get-upstream-branch)
- (magit-merge it '("--ff-only"))
+ (magit-merge-plain it '("--ff-only"))
(user-error "No upstream branch")))
;;;###autoload
@@ -556,8 +556,8 @@ argument. Interactively, this can be accessed using the command
(defun km/magit-log-current (&optional args files)
"Like `magit-log-current', but if head is detached, use \"HEAD\"."
(interactive (magit-log-arguments))
- (magit-log (list (or (magit-get-current-branch) "HEAD"))
- args files))
+ (magit-log-current (list (or (magit-get-current-branch) "HEAD"))
+ args files))
(defun km/magit-log-dwim (&optional args files)
(interactive (magit-log-arguments))
@@ -587,8 +587,8 @@ argument. Interactively, this can be accessed using the command
(and (magit-rev-verify (concat it "^2"))
(concat it "^-1"))))))
(if range
- (magit-log (list range) args files)
- (call-interactively #'magit-log))))
+ (magit-git-log (list range) args files)
+ (call-interactively #'magit-log-current))))
;;;###autoload
(defun km/magit-log-occurrence (beg end)