diff options
author | Xinglu Chen <public@yoctocell.xyz> | 2021-01-25 11:20:57 +0100 |
---|---|---|
committer | Xinglu Chen <public@yoctocell.xyz> | 2021-01-25 11:20:57 +0100 |
commit | f8013352a5844dd096b4c2ec807440ed0813f7ee (patch) | |
tree | b5e1468331b41898f949c8d5d2d9b4dea19d81c0 | |
parent | 3b7f29d64de1c4796b97764adcbabea694a1f2ea (diff) |
git-email.el: Add option for parsing revision
Add an option for parsing the output of
‘git-email--minibuffer-get-revision’. This allows users to customize
the ‘git log’ to run without breaking the format to use for parsing
the result.
* git-email.el (git-email-revision-parser): Add variable.
(git-email--minibuffer-get-revision): Call ‘git-email--parse-revision’.
-rw-r--r-- | git-email.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/git-email.el b/git-email.el index 9bbad13..d1334a1 100644 --- a/git-email.el +++ b/git-email.el @@ -104,6 +104,11 @@ not set, the 'to' address will be empty." :type 'string :group 'git-email) +(defcustom git-email-revision-parser #'git-email--parse-revision + "Function for parsing the output of ‘git-email-revision-command’." + :type 'symbol + :group git-email) + (defcustom git-email-get-revision-functions '(git-email--log-get-revision) "List of functions to get the base commit for 'git format-patch'. If none of the functions return non-nil value, @@ -283,7 +288,13 @@ them into the message buffer." (cycle-sort-function . identity)) (complete-with-action action revs string pred))))) - (substring (completing-read "Revision: " sorted-revs) 0 7))) + (git-email--parse-revision (completing-read "Revision: " sorted-revs)))) + +(defun git-email--parse-revision (rev) + "Return only the revision hash from REV + +This parses the output of ‘git-email--minibuffer-get-revision’." + (substring rev 0 7)) (defun git-email--log-get-revision () "Get the revision at point in `log-view-mode'." |