<commit_before>(setq magit-last-seen-setup-instructions "1.4.0")

(mjhoy/require-package 'magit)
(require 'init-org)
(require 'org-magit)

(setq magit-push-always-verify nil)
(setq magit-revert-buffers 'silent)
(setq magit-revision-show-gravatars nil)

(global-set-key (kbd "C-c g") 'magit-status)

(magit-define-popup-switch 'magit-log-popup
  ?m "Omit merge commits" "--no-merges")

(defun mjhoy/log-current-commit-to-org-clock ()
  "Get the current repository's HEAD commit, and add it as a link
to the current org clock, if one exists."
  (let* ((repo (magit-toplevel))
         (rev  (magit-git-string "rev-list" "HEAD" "--abbrev-commit" "-n" "1"))
         (link (org-magit-make-link repo "::commit@" rev))
         (summary (magit-git-string "log" "HEAD" "--format=%B" "-n" "1"))
         (dir  (file-name-nondirectory (directory-file-name repo))))
    (if (org-clock-is-active)
        (save-excursion
          (set-buffer (org-clocking-buffer))
          (goto-char org-clock-marker)
          (end-of-line)
          (newline)
          (insert "- ")
          (insert (format "[[%s][%s.git commit %s]] %s" link dir rev summary))))))

(defun mjhoy/git-commit-hook ()
  (add-hook 'with-editor-post-finish-hook #'mjhoy/log-current-commit-to-org-clock nil t))

(add-hook 'git-commit-mode-hook #'mjhoy/git-commit-hook)
<commit_msg>emacs: magit: insert [ci skip] for md commits<commit_after>(setq magit-last-seen-setup-instructions "1.4.0")

(mjhoy/require-package 'magit)
(require 'init-org)
(require 'org-magit)

(setq magit-push-always-verify nil)
(setq magit-revert-buffers 'silent)
(setq magit-revision-show-gravatars nil)

(global-set-key (kbd "C-c g") 'magit-status)

(magit-define-popup-switch 'magit-log-popup
  ?m "Omit merge commits" "--no-merges")

(defun mjhoy/log-current-commit-to-org-clock ()
  "Get the current repository's HEAD commit, and add it as a link
to the current org clock, if one exists."
  (let* ((repo (magit-toplevel))
         (rev  (magit-git-string "rev-list" "HEAD" "--abbrev-commit" "-n" "1"))
         (link (org-magit-make-link repo "::commit@" rev))
         (summary (magit-git-string "log" "HEAD" "--format=%B" "-n" "1"))
         (dir  (file-name-nondirectory (directory-file-name repo))))
    (if (org-clock-is-active)
        (save-excursion
          (set-buffer (org-clocking-buffer))
          (goto-char org-clock-marker)
          (end-of-line)
          (newline)
          (insert "- ")
          (insert (format "[[%s][%s.git commit %s]] %s" link dir rev summary))))))

(defun mjhoy/git-commit-hook ()
  (add-hook 'with-editor-post-finish-hook #'mjhoy/log-current-commit-to-org-clock nil t))

(add-hook 'git-commit-mode-hook #'mjhoy/git-commit-hook)

(defun mjhoy/git-commit-ci-skip ()
  "If all staged files are markdown, insert [ci skip] into the
commit message."
  (when (--all? (string-match-p "\\.md$" it) (magit-staged-files))
    (insert " [ci skip]")
    (beginning-of-line)))

(add-hook 'git-commit-setup-hook 'mjhoy/git-commit-ci-skip)

{'fraction_non_alphanumeric': 0.18209054593874835, 'fraction_numerical': 0.003328894806924101, 'mean_word_length': 3.0940054495912808, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2853357', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1135, 'n_words': 251}