Skip to content

Commit

Permalink
magit-log: add defcustom magit-log-highlight-keywords-regexp
Browse files Browse the repository at this point in the history
This will allow users to specify regexp for keywords to highlight in
magit-log-propertize-keywords.
  • Loading branch information
Leif Warland authored and leifwar committed Aug 22, 2023
1 parent f8353f5 commit 5e116cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lisp/magit-log.el
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ This is useful if you use really long branch names."
:group 'magit-log
:type 'boolean)

(defcustom magit-log-highlight-keywords-regexp "\\[[^][]*]"
"Regexp used to highlight keywords in log."
:group 'magit-log
:type 'string)

(defcustom magit-log-header-line-function #'magit-log-header-line-sentence
"Function used to generate text shown in header line of log buffers."
:package-version '(magit . "2.12.0")
Expand Down Expand Up @@ -1459,7 +1464,7 @@ Do not add this to a hook variable."
(magit--put-face (match-beginning 0) (1- boundary)
'magit-keyword-squash msg))
(when magit-log-highlight-keywords
(while (string-match "\\[[^][]*]" msg boundary)
(while (string-match magit-log-highlight-keywords-regexp msg boundary)
(setq boundary (match-end 0))
(magit--put-face (match-beginning 0) boundary
'magit-keyword msg))))
Expand Down

0 comments on commit 5e116cb

Please sign in to comment.