diff options
author | yoctocell <public@yoctocell.xyz> | 2021-01-03 21:09:29 +0100 |
---|---|---|
committer | yoctocell <public@yoctocell.xyz> | 2021-01-03 21:10:04 +0100 |
commit | 269ad9e6b4c9f81d0801d5c793a6fcf20b20fbfc (patch) | |
tree | c207f12721b2aa8c9d22910b5a2f7832d79f3f9b | |
parent | 0ee105afa079c2575007b5b8bdfc35e18e6fa552 (diff) |
Extract to address from git config
* git-email.el (git-email-send-email): Get to address from 'git config --list'.
-rw-r--r-- | git-email.el | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/git-email.el b/git-email.el index 2328957..a66fd16 100644 --- a/git-email.el +++ b/git-email.el @@ -72,21 +72,27 @@ Extracts the relevant headers and the diff from the PATCH-FILE and inserts them into the message buffer." (interactive) - (let ((subject (git-email--extract-header "subject" patch-file)) - (from (git-email--extract-header "from" patch-file)) - (in-reply-to (git-email--extract-header "in-reply-to" patch-file)) - (msg-id (git-email--extract-header "message-id" patch-file)) - (diff (git-email--extract-diff patch-file))) - (funcall git-email--compose-message-function "test" subject - `(("in-reply-to" ,in-reply-to) - ("message-id" ,msg-id) - ("from" ,from))) + (let* ((default-directory (cdr (project-current))) + (subject (git-email--extract-header "subject" patch-file)) + (from (git-email--extract-header "from" patch-file)) + (sendemail-to + (shell-command-to-string "git config --list | grep sendemail.to")) + (to (if (string-equal sendemail-to "") + "to" + (substring sendemail-to 13 -1))) ; Remove newline + (in-reply-to (git-email--extract-header "in-reply-to" patch-file)) + (msg-id (git-email--extract-header "message-id" patch-file)) + (diff (git-email--extract-diff patch-file))) + (funcall git-email--compose-message-function to subject + `(("in-reply-to" ,in-reply-to) + ("message-id" ,msg-id) + ("from" ,from))) ;; (let ((body (or (re-search-forward "<#part .*>") ;; (re-search-forward "--text follows this line--")))) (goto-char (point-max)) (insert diff))) - + (provide 'git-email) ;;; git-email.el ends here |