Closed jasonmj closed 9 months ago
I did a little digging into this issue and I'm not sure the regex is actually the problem. Instead, I think it's the way that the captures are being accessed with match-string
. Since there's a set of parens in the author capture, it doesn't return the correct value. I'll continue to look into this later, just wanted to provide an update.
I think the problem with the regexp, it doesn't catch the first bracket, i'll speculate about it
(setq blamer--regexp-info
(concat "^(?\\(?1:[^ ]*\\).*[[:blank:]]\(\\(?2:[^\n]+\\)"
"\s\\(?3:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
"\s\\(?4:[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))
Can you try to use this regexp ?
Hmm, that did not seem to help.
Annoyingly, I did manage to fix it at one point with some testing I did in a scratch buffer, but I lost that work. I'll try to give it another go later... might be next week for me though. Busy times! Thanks for your response and attempt to fix 🙏
This is working for me:
(setq blamer--regexp-info
(concat "^(?\\(?1:[^ ]*\\) [^ ]*[[:blank:]]?\(\\(?2:.*\\)"
"\s\\(?3:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
"\s\\(?4:[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))
Unfortunately, It doesn't work with the author's name without spaces, for example
(^3130q6ze (TomBombadil(he/him) 2020-12-16 16:28:09 +0800 4) $tooltip-border-radius: 2px;)
Could you try this one?
(concat "(\\(?1:[^ ]*\\) (\\(?2:.*\\)"
"\s\\(?3:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
"\s\\(?4:[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)")
Hmm, your blame message looks different than what I typically have. Here's what I've been testing with:
(setq blamer--regexp-info
(concat "^(?\\(?1:[^ ]*\\) [^ ]*[[:blank:]]?\(\\(?2:.*\\)"
"\s\\(?3:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
"\s\\(?4:[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))
(setq-local blame-msg "3b90f8b82 lib/project_web/live/installation_live/show.html.heex (TomBombadil(he/him) 2023-03-16 08:08:26 -0500 25) <div class=\"flex justify-between gap-4\">")
(string-match blamer--regexp-info blame-msg)
(message "%s" (match-string 2 blame-msg))
The latest regex you posted did not work with my blame-msg.
Oh, i got it, my tests were wrong. Sorry for the inconvenience, I try to find a silver bullet for this problem. Can you check this regexp please?
(concat "^\\(?1:[^ ]*\\) \\(?5:[^ ]* \\)?(\\(?2:.*\\)"
"\s\\(?3:[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)"
"\s\\(?4:[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)")
before after
It's working for me :tada:
Thanks for your help here. It's been nice working with you.
I noticed that the author name is not getting formatted correctly when it includes parenthesis, like:
Tom Bombadil (he/him)
. Instead, onlyhe/him)
gets printed. I suspect this is related toblamer--regexp-info
.