diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-06-05 19:41:47 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-06-06 00:09:01 -0400 |
commit | 5631f6d6371c243b85c54c20f3baa5a44b40c5c3 (patch) | |
tree | 46b259726a269072888e8a64182f526d6d289ed9 | |
parent | 4a32347513643b5b45e00a7e8c7d1fac8d8a4103 (diff) | |
download | piem-5631f6d6371c243b85c54c20f3baa5a44b40c5c3.tar.gz |
piem: Take in some options from -b4
These are things that will be used outside of piem-b4.
-rw-r--r-- | piem-b4.el | 18 | ||||
-rw-r--r-- | piem.el | 10 |
2 files changed, 15 insertions, 13 deletions
@@ -45,15 +45,7 @@ "Which b4 executable to use." :type 'string) -(defcustom piem-b4-git-executable - (or (and (boundp 'magit-git-executable) magit-git-executable) - "git") - "Which git executable to use." - :type 'string) -(defcustom piem-b4-use-magit (featurep 'magit) - "Whether to use Magit where possible." - :type 'boolean) (defcustom piem-b4-default-branch-function #'piem-b4-name-branch-who-what-v @@ -227,7 +219,7 @@ in `piem-b4-default-branch-function'." (completing-read "Project: " (projectile-relevant-known-projects))) - (and piem-b4-use-magit + (and piem-use-magit (fboundp 'magit-read-repository) (magit-read-repository)) (read-directory-name "Git repository: "))) @@ -241,21 +233,21 @@ in `piem-b4-default-branch-function'." (funcall piem-b4-default-branch-function info))) (base (completing-read "Base commit: " - (let ((cands (and piem-b4-use-magit + (let ((cands (and piem-use-magit (fboundp 'magit-list-local-branch-names) (magit-list-local-branch-names))) (base (plist-get info :base-commit))) (if base (cons base cands) cands))))) (apply #'piem-process-call piem-b4-output-buffer nil - piem-b4-git-executable "checkout" + piem-git-executable "checkout" (append (if (string-empty-p new-branch) (list "--detach") (list "-b" new-branch)) (list base)))) (piem-process-call piem-b4-output-buffer nil - piem-b4-git-executable "am" "--scissors" + piem-git-executable "am" "--scissors" mbox-file) - (if (and piem-b4-use-magit + (if (and piem-use-magit (fboundp 'magit-status-setup-buffer)) (magit-status-setup-buffer) (dired ".")))) @@ -129,6 +129,16 @@ intended to be used by libraries implementing a function for (when (string-match-p (regexp-quote addr) to) (throw 'hit (car inbox))))))))) +(defcustom piem-git-executable + (or (and (boundp 'magit-git-executable) magit-git-executable) + "git") + "Which git executable to use." + :type 'string) + +(defcustom piem-use-magit (featurep 'magit) + "Whether to use Magit where possible." + :type 'boolean) + ;;;; Subprocess handling |