branch: elpa/magit
commit 7dd9b77f90a1701fe0362262f02da8b9300c7366
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
git-rebase-mode-font-lock-keywords: Use single regexp for merge lines
Tweak the merge regexp in `git-rebase-line-regexps' so that it can be
used for merge lines with and without a description.
---
lisp/git-rebase.el | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el
index 1fec67876f1..7aa76942129 100644
--- a/lisp/git-rebase.el
+++ b/lisp/git-rebase.el
@@ -321,6 +321,8 @@ region is active, act on all lines touched by the region."
(abbrev)))
(defvar git-rebase-line-regexps
+ ;; <action> <commit> [[# ] <oneline>]
+ ;; fixup [-C|-c] <commit> [[# ] <oneline>]
`((commit . ,(concat
(regexp-opt '("d" "drop"
"e" "edit"
@@ -340,10 +342,12 @@ region is active, act on all lines touched by the region."
"u" "update-ref")
"\\(?1:")
" \\(?3:[^ \n]+\\) ?\\(?4:.*\\)"))
+ ;; merge [-C <commit> | -c <commit>] <label> [# <oneline>]
+ ;; <commit> is matched by group 22 (part of group 2), not group 3
(merge . ,(concat "\\(?1:m\\|merge\\) "
- "\\(?:\\(?2:-[cC] [^ \n]+\\) \\)?"
+ "\\(?:\\(?2:\\(?21:-[cC]\\) \\(?22:[^ \n]+\\)\\) \\)?"
"\\(?3:[^ \n]+\\)"
- " ?\\(?4:.*\\)"))))
+ "\\(?: # \\(?4:.*\\)\\)?"))))
;;;###autoload
(defun git-rebase-current-line (&optional batch)
@@ -814,14 +818,12 @@ running \"man git-rebase\" at the command line) for
details."
(1 'git-rebase-action)
(3 'git-rebase-label)
(4 'git-rebase-description))
- ("^\\(m\\(?:erge\\)? -[Cc]\\) \\([^ \n]+\\) \\([^ \n]+\\)\\( #.*\\)?"
- (1 'git-rebase-action)
- (2 'git-rebase-hash)
- (3 'git-rebase-label)
- (4 'git-rebase-description))
- ("^\\(m\\(?:erge\\)?\\) \\([^ \n]+\\)"
- (1 'git-rebase-action)
- (2 'git-rebase-label))
+ (,(concat "^" (cdr (assq 'merge git-rebase-line-regexps)))
+ (1 'git-rebase-action)
+ (21 'git-rebase-action nil t)
+ (22 'git-rebase-hash t t)
+ (3 'git-rebase-label)
+ (4 'git-rebase-description nil t))
("^drop \\(.+\\)"
(1 'git-rebase-killed-action t))
(,(concat git-rebase-comment-re " *"