This commit is contained in:
Daniel Ziltener 2024-08-30 11:27:10 +02:00
parent db8f40ca30
commit abccdcb27e
Signed by: zilti
GPG key ID: B38976E82C9DAE42
2 changed files with 15 additions and 11 deletions

View file

@ -757,17 +757,19 @@ Point must be at the beginning of balanced expression (sexp)."
;; The following snippet is a convenience function for git-commit to add the ticket number, if found
;; in the branch name, to the commit message.
(use-package git-commit
:hook
(git-commit-mode
.
(lambda ()
(defun add-git-commit-ticket-id-from-branch ()
"A git-commit-mode-hook which inserts the first consecutive
sequence of at least 3 digits in the current branch name at
the beginning of the commit message buffer (in square
brackets)."
(when-let ((branch (magit-get-current-branch)))
(when (string-match "\\(ticket\\|feature\\)-\\([[:digit]]\\{3,\\}\\)" branch)
(let ((prefix (format "[T-%s] \n" (match-string 2 branch))))
(when (string-match "\\([[:digit:]]\\{3,\\}\\)" branch)
(let ((prefix (format "[T-%s] \n" (match-string 1 branch))))
(goto-char (point-min))
(insert prefix)
(forward-char -1)))))))
(forward-char -1)))))
(add-hook 'git-commit-mode-hook 'add-git-commit-ticket-id-from-branch)
;; Magit requires 'transient' >= 0.5.0, but due to bad defaults, Emacs' package manager refuses to
;; upgrade this and other built-in packages to higher releases from GNU Elpa.

View file

@ -21,6 +21,7 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
freetype
gcc
ghostscript
gimp-with-plugins
git-cola
git-doc
git-filter-repo
@ -31,6 +32,7 @@ args@{ config, pkgs, split-monitor-workspaces, flatpaks, ... }:
iconv
kteatime
lagrange
libreoffice-qt6-fresh
liquidprompt
kdePackages.dolphin
kdePackages.ksshaskpass