Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to claude-code.el will be documented in this file.

## [0.4.5]

### Added
- New `claude-code-display-window-fn` customization option (#100) to control display of Claude COde buffer

### Changed

### Fixed
- Fixed bug reporting line position when narrowring is in effect (#74)

## [0.4.4]

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ You can customize how Claude Code windows are displayed by setting `claude-code-

#### Using display-buffer-alist

You can also control how the Claude Code window appears using Emacs' `display-buffer-alist`. For example, to make the Claude window appear in a persistent side window on the right side of your screen with 33% width:
You can also control how the Claude Code window appears using Emacs' `display-buffer-alist`. For example, to make the Claude window appear in a persistent side window on the right side of your screen that is 90 characters wide:

```elisp
(add-to-list 'display-buffer-alist
Expand Down
17 changes: 15 additions & 2 deletions claude-code.el
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;;; claude-code.el --- Claude Code Emacs integration -*- lexical-binding: t; -*-

;; Author: Stephen Molitor <stevemolitor@gmail.com>
;; Version: 0.4.4
;; Version: 0.4.5
;; Package-Requires: ((emacs "30.0") (transient "0.9.3"))
;; Keywords: tools, ai
;; URL: https://github.com/stevemolitor/claude-code.el
Expand Down Expand Up @@ -790,6 +790,17 @@ _BACKEND is the terminal backend type (should be \\='vterm)."
_BACKEND is the terminal backend type (should be \\='vterm)."
vterm-copy-mode)

(defun claude-code--vterm-window-scroll-advice (&rest _)
"Turn on vterm-copy-mode when scrolling in vterm claude buffer.

This allows the user to scroll backwards while the LLM is outputing new
text."
(advice-add 'set-window-vscroll :after
(when (and (claude-code--buffer-p (current-buffer)) (eq major-mode 'vterm-mode))
(if (> (window-end) (buffer-size))
(when vterm-copy-mode (claude-code-exit-read-only-mode))
(claude-code-read-only-mode)))))

(cl-defmethod claude-code--term-configure ((_backend (eql vterm)))
"Configure vterm terminal in current buffer.

Expand Down Expand Up @@ -817,7 +828,9 @@ _BACKEND is the terminal backend type (should be \\='vterm)."
;; Set up bell detection advice
(advice-add 'vterm--filter :around #'claude-code--vterm-bell-detector)
;; Set up multi-line buffering to prevent flickering
(advice-add 'vterm--filter :around #'claude-code--vterm-multiline-buffer-filter))
(advice-add 'vterm--filter :around #'claude-code--vterm-multiline-buffer-filter)
;; Allow scrolling in Claude buffer when LLM is streaming a response
(advice-add 'set-window-vscroll :after #'claude-code--adjust-window-size-advice))

(cl-defmethod claude-code--term-customize-faces ((_backend (eql vterm)))
"Apply face customizations for vterm terminal.
Expand Down