@@ -81,6 +81,11 @@ Display indicators in the left fringe for Git changes.
8181;; (setq git-gutter:update-interval 0.02))
8282
8383(use-package git-gutter-fringe
84+ :ensure t
85+ :hook
86+ ;; Only enable for file buffers in version control
87+ ((find-file . git-gutter-mode)
88+ (after-revert-hook . git-gutter-mode))
8489 :config
8590 (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated))
8691 (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated))
@@ -94,6 +99,15 @@ Display indicators in the left fringe for Git changes.
9499 :config
95100 (setq git-messenger:show-detail t
96101 git-messenger:use-magit-popup t))
102+
103+
104+ ;; (use-package forge
105+ ;; :ensure t
106+ ;; :after magit
107+ ;; :config
108+ ;; ;; Optional: Add your GitHub token if you want to avoid frequent authentication
109+ ;; ;; (setq forge-alist (append forge-alist '((github "api.github.com" "github.com" forge-github-repository))))
110+ ;; )
97111#+end_src
98112
99113Major modes for Git-specific files.
@@ -814,6 +828,20 @@ START and END mark the region."
814828(use-package cmake-mode)
815829#+end_src
816830
831+ * Common Lisp
832+
833+ #+begin_src emacs-lisp
834+ ;; Load SLIME
835+ (load (expand-file-name "/home/marco/.quicklisp/slime-helper.el"))
836+
837+ ;; Set up SLIME
838+ (setq inferior-lisp-program "sbcl")
839+ (setq slime-contribs '(slime-fancy))
840+
841+ ;; Basic preferences
842+ (show-paren-mode 1)
843+ #+end_src
844+
817845* Statistics
818846
819847#+begin_src emacs-lisp
@@ -1202,6 +1230,14 @@ Uses `*compilation: <project-name>*` if in a project, otherwise `*compilation*`.
12021230
12031231(setq sql-ms-program "/opt/mssql-tools18/bin/sqlcmd")
12041232(setq sql-ms-options '("-C")) ; trust self-signed cert
1233+
1234+ (add-hook 'sql-interactive-mode-hook
1235+ (lambda ()
1236+ (run-at-time "0.1 sec" nil
1237+ (lambda (buf)
1238+ (with-current-buffer buf
1239+ (setq-local truncate-lines t)))
1240+ (current-buffer))))
12051241#+end_src
12061242
12071243* Yaml
@@ -1280,6 +1316,121 @@ Uses `*compilation: <project-name>*` if in a project, otherwise `*compilation*`.
12801316 :config
12811317 (setq claude-code-ide-cli-path "~/.local/bin/claude")
12821318 (claude-code-ide-emacs-tools-setup))
1319+
1320+ (defvar-local cunene/claude-prompt-edit--target-buffer nil
1321+ "The Claude Code terminal buffer that this edit buffer is associated with.")
1322+
1323+ (defvar cunene/claude-prompt-edit-mode-map
1324+ (let ((map (make-sparse-keymap)))
1325+ (define-key map (kbd "C-c '") #'cunene/claude-prompt-edit-send)
1326+ (define-key map (kbd "C-c C-c") #'cunene/claude-prompt-edit-send-and-submit)
1327+ (define-key map (kbd "C-c C-k") #'cunene/claude-prompt-edit-cancel)
1328+ map)
1329+ "Keymap for `cunene/claude-prompt-edit-mode'.")
1330+
1331+ (define-minor-mode cunene/claude-prompt-edit-mode
1332+ "Minor mode for editing Claude Code prompts in a dedicated buffer.
1333+
1334+ \\{cunene/claude-prompt-edit-mode-map}"
1335+ :lighter " Claude-Edit"
1336+ :keymap cunene/claude-prompt-edit-mode-map
1337+ (when cunene/claude-prompt-edit-mode
1338+ (setq header-line-format
1339+ (substitute-command-keys
1340+ "Edit prompt. \\[cunene/claude-prompt-edit-send]: send \
1341+ \\[cunene/claude-prompt-edit-send-and-submit]: send+submit \
1342+ \\[cunene/claude-prompt-edit-cancel]: cancel"))))
1343+
1344+ (defun cunene/claude-prompt-edit--buffer-name (terminal-buffer)
1345+ "Return the name for the prompt edit buffer associated with TERMINAL-BUFFER."
1346+ (format "*claude-prompt-edit[%s]*"
1347+ (replace-regexp-in-string
1348+ "\\*claude-code\\[\\(.*\\)\\]\\*" "\\1"
1349+ (buffer-name terminal-buffer))))
1350+
1351+ (defun cunene/claude-prompt-edit--send-text (text &optional submit)
1352+ "Send TEXT to the terminal, optionally pressing return if SUBMIT is non-nil.
1353+ Handles multi-line text by converting newlines to backslash+return sequences."
1354+ (let ((lines (split-string text "\n")))
1355+ (dotimes (i (length lines))
1356+ (let ((line (nth i lines)))
1357+ (claude-code-ide--terminal-send-string line)
1358+ (when (< i (1- (length lines)))
1359+ (claude-code-ide--terminal-send-string "\\")
1360+ (sit-for 0.05)
1361+ (claude-code-ide--terminal-send-return)
1362+ (sit-for 0.05)))))
1363+ (when submit
1364+ (sit-for 0.1)
1365+ (claude-code-ide--terminal-send-return)))
1366+
1367+ (defun cunene/claude-prompt-edit--close-buffer ()
1368+ "Close the current prompt edit buffer and its window."
1369+ (let ((edit-window (get-buffer-window (current-buffer))))
1370+ (kill-buffer (current-buffer))
1371+ (when (window-live-p edit-window)
1372+ (delete-window edit-window))))
1373+
1374+ (defun cunene/claude-prompt-edit-send ()
1375+ "Send the edited prompt to the terminal without pressing return."
1376+ (interactive)
1377+ (unless cunene/claude-prompt-edit-mode
1378+ (user-error "Not in a Claude prompt edit buffer"))
1379+ (let ((text (string-trim (buffer-string)))
1380+ (target-buffer cunene/claude-prompt-edit--target-buffer))
1381+ (unless (and target-buffer (buffer-live-p target-buffer))
1382+ (user-error "Target Claude buffer no longer exists"))
1383+ (cunene/claude-prompt-edit--close-buffer)
1384+ (with-current-buffer target-buffer
1385+ (cunene/claude-prompt-edit--send-text text nil))
1386+ (message "Sent prompt to Claude (no submit)")))
1387+
1388+ (defun cunene/claude-prompt-edit-send-and-submit ()
1389+ "Send the edited prompt to the terminal and press return to submit."
1390+ (interactive)
1391+ (unless cunene/claude-prompt-edit-mode
1392+ (user-error "Not in a Claude prompt edit buffer"))
1393+ (let ((text (string-trim (buffer-string)))
1394+ (target-buffer cunene/claude-prompt-edit--target-buffer))
1395+ (unless (and target-buffer (buffer-live-p target-buffer))
1396+ (user-error "Target Claude buffer no longer exists"))
1397+ (cunene/claude-prompt-edit--close-buffer)
1398+ (with-current-buffer target-buffer
1399+ (cunene/claude-prompt-edit--send-text text t))
1400+ (message "Sent and submitted prompt to Claude")))
1401+
1402+ (defun cunene/claude-prompt-edit-cancel ()
1403+ "Cancel editing and close the prompt edit buffer without sending."
1404+ (interactive)
1405+ (unless cunene/claude-prompt-edit-mode
1406+ (user-error "Not in a Claude prompt edit buffer"))
1407+ (cunene/claude-prompt-edit--close-buffer)
1408+ (message "Prompt edit cancelled"))
1409+
1410+ (defun cunene/claude-prompt-edit ()
1411+ "Open a buffer to compose a prompt for Claude Code.
1412+ The prompt can be edited with full Emacs editing capabilities.
1413+
1414+ Keybindings in the edit buffer:
1415+ C-c ' - Send prompt to terminal (for review, no submit)
1416+ C-c C-c - Send prompt and submit (press Return)
1417+ C-c C-k - Cancel and close without sending"
1418+ (interactive)
1419+ (let ((buffer-name (claude-code-ide--get-buffer-name)))
1420+ (if-let ((terminal-buffer (get-buffer buffer-name)))
1421+ (let* ((edit-buffer-name (cunene/claude-prompt-edit--buffer-name terminal-buffer))
1422+ (edit-buffer (get-buffer-create edit-buffer-name)))
1423+ (with-current-buffer edit-buffer
1424+ (erase-buffer)
1425+ (text-mode)
1426+ (cunene/claude-prompt-edit-mode 1)
1427+ (setq-local cunene/claude-prompt-edit--target-buffer terminal-buffer))
1428+ (display-buffer edit-buffer
1429+ '((display-buffer-below-selected)
1430+ (window-height . 10)))
1431+ (select-window (get-buffer-window edit-buffer))
1432+ (message "Compose your prompt. C-c ' to send, C-c C-c to send+submit, C-c C-k to cancel"))
1433+ (user-error "No Claude Code session for this project"))))
12831434#+end_src
12841435
12851436* Eldoc
0 commit comments