Skip to content

Commit 627cd0d

Browse files
committed
[github-copilot] Make commit message generation opt-in
1 parent 7d0ddf0 commit 627cd0d

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

layers/+web-services/github-copilot/README.org

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ be necessary to add the new binding manually. Details for this can be found [[ht
4949

5050
For the chat interface a separate login procedure will be necessary once a chat is started.
5151

52+
To enable automatic generation of git commit messages using
53+
copilot-chat, set the layer variable
54+
=github-copilot-enable-commit-messages= to t. Alternatively, you can
55+
invoke =SPC SPC copilot-chat-insert-commit-message= manually.
56+
5257
* Key bindings
5358
** General
5459

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
;;; config.el --- github-copilot layer configuration file for Spacemacs -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2025 Aaron Zeng
4+
5+
;; Author: Aaron Zeng <[email protected]>
6+
7+
;; This program is free software; you can redistribute it and/or modify
8+
;; it under the terms of the GNU General Public License as published by
9+
;; the Free Software Foundation, either version 3 of the License, or
10+
;; (at your option) any later version.
11+
12+
;; This program is distributed in the hope that it will be useful,
13+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
;; GNU General Public License for more details.
16+
17+
;; You should have received a copy of the GNU General Public License
18+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
(defvar github-copilot-enable-commit-messages nil
21+
"If non-nil, automatically generate commit messages (for magit) using Copilot.")

layers/+web-services/github-copilot/packages.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@
4242
(defun github-copilot/init-copilot-chat ()
4343
"Initialize the `copilot-chat' package and set up keybindings."
4444
(use-package copilot-chat
45-
:hook (git-commit-setup . copilot-chat-insert-commit-message)
4645
:defer t
4746
:init
4847
;; Provide our transient state in the AI menu
4948
(spacemacs/declare-prefix "$" "AI")
5049
(spacemacs/set-leader-keys "$c" 'copilot-chat-transient)
50+
(when github-copilot-enable-commit-messages
51+
(add-hook 'git-commit-setup-hook
52+
#'copilot-chat-insert-commit-message))
5153
:config
5254
;; Make sure that standard ,, works as confirm in the chat window
5355
(evil-define-key 'normal copilot-chat-prompt-mode-map ",," #'copilot-chat-prompt-send)

0 commit comments

Comments
 (0)