aboutsummaryrefslogtreecommitdiff
path: root/git-email.el
diff options
context:
space:
mode:
authoryoctocell <public@yoctocell.xyz>2021-01-18 12:35:04 +0100
committeryoctocell <public@yoctocell.xyz>2021-01-18 12:35:04 +0100
commit1b0778eb9dec87217423e2182a2f64113ccc257b (patch)
tree67042f21788b9e31ac70107221ba3fbc970356a9 /git-email.el
parent62eea1404be3b1eba394759ec472c796206721e6 (diff)
Move cursor to "to" address if empty
The cursor will be placed at the "to" header if it is empty when composing a message.
Diffstat (limited to 'git-email.el')
-rw-r--r--git-email.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/git-email.el b/git-email.el
index 5b72b33..0c55183 100644
--- a/git-email.el
+++ b/git-email.el
@@ -67,8 +67,10 @@
(defcustom git-email-headers
'(subject from in-reply-to message-id references)
"List of headers that should get inserted into the message buffer.
-The 'to' address will always be inserted based on the 'sendemail.to' variable
-in you git config. If the variable is not set, the 'to' address will be empty."
+
+The 'to' address will always be inserted based on the
+'sendemail.to' variable in you git config. If the variable is
+not set, the 'to' address will be empty."
:group 'git-email
:type '(symbol))
@@ -240,7 +242,7 @@ them into the message buffer."
(sendemail-to
(shell-command-to-string "git config --list | grep sendemail.to"))
(to (if (string-equal sendemail-to "")
- ""
+ "*** TO ADDRESS HERE ***"
(substring sendemail-to 13 -1))) ; Remove newline
(diff (git-email--extract-diff patch-file)))
(funcall git-email-compose-email-function to
@@ -257,8 +259,9 @@ them into the message buffer."
(save-excursion
(insert (git-email--fontify-using-faces
(git-email--fontify-diff diff)))))
- ;; Jump to subject if it is a cover letter
- (when (re-search-backward "\\*\\*\\* SUBJECT HERE \\*\\*\\*" nil t)
+ ;; Jump to subject or 'to' address if they are emtpy
+ (when (or (re-search-backward "\\*\\*\\* TO ADDRESS HERE \\*\\*\\*" nil t)
+ (re-search-backward "\\*\\*\\* SUBJECT HERE \\*\\*\\*" nil t))
(kill-line))))
;;;; Format patches