.
This commit is contained in:
parent
db8f40ca30
commit
abccdcb27e
2 changed files with 15 additions and 11 deletions
|
@ -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.
|
||||
|
|
2
home.nix
2
home.nix
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue