From a95b01a923283352786620e2c3c289360b7d207f Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Fri, 3 Nov 2023 19:55:04 +0100 Subject: [PATCH] docs(emacs/applications): highlight commit keywords in git logs --- docs/emacs/packages/applications.org | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/emacs/packages/applications.org b/docs/emacs/packages/applications.org index f019568..7099038 100644 --- a/docs/emacs/packages/applications.org +++ b/docs/emacs/packages/applications.org @@ -1381,6 +1381,7 @@ doing and what Git is doing! In short, I absolutely love it! (setq forge-add-default-bindings nil) :config (add-hook 'magit-process-find-password-functions 'magit-process-password-auth-source) + <> (csetq magit-clone-default-directory "~/fromGIT/" magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1) (with-eval-after-load 'evil-collection @@ -1440,6 +1441,28 @@ Magit and bug [[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62093][62093]] of #'my--tramp-send-command--workaround-stty-icanon-bug--filter-args) #+end_src +I also want to highlight these angular-style keywords in commit messages. +#+name: magit-angular-keywords-highlight +#+begin_src emacs-lisp :tangle no +(defun my/magit-log-highlight-angular-keywords (_rev msg) + "Highlight angular-style keywords in commit messages." + (let ((boundary 0)) + (when (string-match (rx (seq (or "feat" "fix" "docs" "style" "refactor" + "perf" "test" "chore") + (* "(" (* (not ")")) ")") + ":")) + msg + boundary) + (setq boundary (match-end 0)) + (magit--put-face (match-beginning 0) boundary + 'magit-keyword msg))) + msg) + +(advice-add #'magit-log-propertize-keywords + :after + #'my/magit-log-highlight-angular-keywords) +#+end_src + [[https://github.com/alphapapa][Alphapapa]] also created an awesome package for Magit: magit-todos which display in the Magit buffer a list of TODOs found in the current project to remind you of what to do next.