;; Draftweilding
(keymap-global-set "C-x v C" #'re/vc-clone)
(keymap-global-set "C-x v b b" #'re/vc-show-branches)
+(keymap-global-set "C-x v f" #'re/vc-fetch)
+
(add-hook 'vc-dir-mode-hook
(lambda ()
- (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches)))
+ (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches)
+ (keymap-set vc-dir-mode-map "f" #'re/vc-fetch)))
;; (E)Lisp
(dir (read-string "Local Dir: " (file-name-base url))))
(vc-clone url nil dir nil)))
-(defun re/vc-show-branches ()
- "Display all Git branches in a separate buffer."
- (interactive)
+(defun re/vc-show-branches (&optional arg)
+ "Display all Git branches in a separate buffer.
+Remotes as well when arg."
+ (interactive "P")
(let ((default-directory (if (boundp 'vc-dir-directory)
vc-dir-directory
default-directory)))
- (vc-git-command "*git-branches*" nil nil "branch" "--verbose")
+ (vc-git-command "*git-branches*"
+ nil
+ nil
+ "branch"
+ "--verbose"
+ (when arg "--remotes"))
(pop-to-buffer "*git-branches*")
(goto-char (point-min))
(special-mode)))
+(defun re/vc-fetch (&optional arg)
+ "Interactively fetch with vc-mode.
+Allows separate fetch in addition to pull. Only care about git.
+With arg, ask for remote, otherwise fetch all."
+ (interactive "P")
+ (let* ((default-directory (if (boundp 'vc-dir-directory)
+ vc-dir-directory
+ default-directory)))
+ (vc-git-command "*vc-fetch*"
+ nil
+ nil
+ "fetch"
+ (if arg
+ (read-string "Fetch From: " "origin")
+ "--all")
+ "--verbose")
+ (pop-to-buffer "*vc-fetch*")
+ (goto-char (point-min))
+ (special-mode)))
+
(defun re/keyboard-quit ()
"Smarter version of `keyboard-quit'.
Close the minibuffer if not focused when hit.