diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/init.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ef2920ca..40429e9d 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -2482,6 +2482,28 @@ Called by '~/src/dotfiles/bin/emacsclient --spw/update-environment'." (insert "#+title: "))) (spw/feature-define-keys org "\C-z\C-t" spw/org-title) +(defun spw/git-format-patch (args &optional new) + "Git-specific `vc-prepare-patch' w/ non-nil `vc-prepare-patches-separately'. +We want to take advantage of the -<n> and -v arguments to +git-format-patch(1), and also of how it numbers the patches." + (interactive "sgit format-patch \nP") + (let* ((patches-from default-directory) + (v (and (string-match "\\_<-\\(?:v\\|-reroll-count\\)\\([0-9]+\\)\\b" + args) + (match-string 1 args))) + (prefix (format "[%sPATCH%s] " + (if (string-match "\\_<--rfc\\b" args) "RFC " "") + (if v (concat " v" v) "")))) + (compose-mail nil prefix nil (not new)) + (save-excursion + (goto-char (point-max)) + (terpri (current-buffer) t) + (mapc #'mail-add-attachment + (let ((default-directory patches-from)) + (apply #'process-lines + "git" "format-patch" + (split-string-and-unquote args))))))) + ;;;; Terminal emulation |