From 673748c59392c948a844a9eb4c48f6211fba2687 Mon Sep 17 00:00:00 2001 From: rearman Date: Fri, 22 Aug 2025 11:44:29 -0400 Subject: [PATCH] Break out vc-defuns into its own feature --- init.el | 1 + re/re-editing-defuns.el | 45 ------------------------------------ re/re-vc-defuns.el | 51 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 45 deletions(-) create mode 100644 re/re-vc-defuns.el diff --git a/init.el b/init.el index de373cf..fe80ddc 100644 --- a/init.el +++ b/init.el @@ -12,6 +12,7 @@ (require 're-packages) (require 're-editing-defuns) +(require 're-vc-defuns) (require 'acme-mouse) (require 'fully-mono-themes) (require 're-os-specific) diff --git a/re/re-editing-defuns.el b/re/re-editing-defuns.el index fdeb1e4..902b148 100644 --- a/re/re-editing-defuns.el +++ b/re/re-editing-defuns.el @@ -160,51 +160,6 @@ Taken from https://www.masteringemacs.org/article/fixing-mark-commands-transient (interactive) (set-mark-command 1)) -(defun re/vc-clone () - "Interactively clone with vc-mode. -Prompt for url and local dir." - (interactive) - (let* ((url (read-string "Repository URL: ")) - (dir (read-string "Local Dir: " (file-name-base url)))) - (vc-clone url nil dir nil))) - -(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" - (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. diff --git a/re/re-vc-defuns.el b/re/re-vc-defuns.el new file mode 100644 index 0000000..b5b9ab3 --- /dev/null +++ b/re/re-vc-defuns.el @@ -0,0 +1,51 @@ +;;; re-vc-defuns.el -*- lexical-binding: t; -*- +;; This file is not part of GNU Emacs. + +;;; Code: + +(defun re/vc-clone () + "Interactively clone with vc-mode. +Prompt for url and local dir." + (interactive) + (let* ((url (read-string "Repository URL: ")) + (dir (read-string "Local Dir: " (file-name-base url)))) + (vc-clone url nil dir nil))) + +(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" + (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))) + +;;; re-vc-defuns.el ends here -- 2.39.5