diff options
author | yoctocell <public@yoctocell.xyz> | 2021-01-06 17:25:10 +0100 |
---|---|---|
committer | yoctocell <public@yoctocell.xyz> | 2021-01-06 17:25:10 +0100 |
commit | 39359f400d567562093e4171f839f8ec8df8f4b4 (patch) | |
tree | 1f8e29778df689295a6322fda84cca36023f7ec4 /git-email.el | |
parent | 5b37163de00d936384ca4bfc52b12bc5c8ea827d (diff) |
Make `git-email-apply-patch' more configurable
The user can supply a custom function and command to used instead of the
default ones.
* git-email.el (git-email-apply-patch-function):
(git-email-apply-patch-command):
(git-email--shell-command-on-body):
(git-email-apply-patch):
Diffstat (limited to 'git-email.el')
-rw-r--r-- | git-email.el | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/git-email.el b/git-email.el index 244f44e..d8f3069 100644 --- a/git-email.el +++ b/git-email.el @@ -96,6 +96,20 @@ in you git config. If the variable is not set, the 'to' address will be empty." :type 'int :group 'git-email) +(defcustom git-email-apply-patch-function + 'git-email--shell-command-on-body + "Function that executes a shell command on the body of the message. +This function should take one argument, it should be the shell command to +execute. By default it is determined by the `git-email-apply-patch-command' +variable." + :type 'symbol + :group 'git-email) + +(defcustom git-email-apply-patch-command "git am" + "Command to run to apply the patch." + :type 'string + :group 'git-email) + ;; Compile warnings (declare-function dired-get-filename "dired.el") (declare-function dired-map-over-marks "dired.el") @@ -111,6 +125,10 @@ in you git config. If the variable is not set, the 'to' address will be empty." (funcall git-email-send-email-function)) buffers))) +(defun git-email--shell-command-on-body (command) + "Get the body of the message in the current buffer and run COMMAND on it." + (shell-command-on-region (point-min) (point-max) command)) + (defun git-email--extract-header (header) "Extract HEADER from current buffer." (goto-char (point-min)) @@ -232,7 +250,8 @@ If no marks are found, return the filename at point." (interactive (list (project-prompt-project-dir))) (let ((default-directory project)) (push (list project) project--list) - (shell-command-on-region (point-min) (point-max) "git am"))) + (funcall git-email-apply-patch-function + git-email-apply-patch-command))) ;;;###autoload (defun git-email-send-email () |