Why I want truncate-lines nil:
Because the replies are output like this and I can't read them:

With truncate-lines nil it's not much better to be honest, but the text is at least visible:

How I wanted to do this:
I figured that since there is copilot-chat-org-prompt-mode-hook then I can just hook into it and disable truncate-lines, but it doesn't work because polymode overwrites this. I traced where the truncate-lines variable is changed and first my hook would disable it, then polymode would happily turn it back on.
There is a way to work around this by hooking into org-mode-hook instead, but it feels too convoluted for me and prone to destabilization.
Steps:
Use this minimal init.el:
;; Setup the package archives
(require 'package)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; A straight-forward way to disable truncate-lines in Copilot Chat Org prompt mode.
;; The catch is... it doesn't work.
(defun my/turn-off-truncate-lines ()
(message "Disabling truncate-lines")
(setq-local truncate-lines nil))
(use-package copilot-chat
:ensure t
:defer t
:hook (copilot-chat-org-prompt-mode . my/turn-off-truncate-lines))
M-x copilot-chat-display
- Ensure the chat buffer is an org-mode buffer.
C-h v truncate-lines - it will say that the value is t.
- Inspect the Messages buffer and see that "Disabling truncate-lines" is there.
Workaround:
Hook into org-mode-hook instead and check the buffer name. Also, pray that the buffer name won't change in future releases:
;; Setup the package archives
(require 'package)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; The convoluted way that actually works:
(defun my/turn-off-copilot-org-truncate-lines ()
"Disable `truncate-lines' in Copilot Chat buffer."
(when (string-match-p "Copilot Chat" (buffer-name))
(message "Disabling truncate-lines in Copilot Chat buffer")
(setq-local truncate-lines nil)))
(use-package copilot-chat
:ensure t
:defer t
:hook (org-mode . my/turn-off-copilot-org-truncate-lines))
Here's my full init.el for reference:
https://bitbucket.org/zalewa/dotfiles/src/2434e8ff09ebfe1d5ec32188eac9eab1cd988b51/.emacs.d/init.el?at=master
Why I want
truncate-lines nil:Because the replies are output like this and I can't read them:
With
truncate-lines nilit's not much better to be honest, but the text is at least visible:How I wanted to do this:
I figured that since there is
copilot-chat-org-prompt-mode-hookthen I can just hook into it and disabletruncate-lines, but it doesn't work because polymode overwrites this. I traced where thetruncate-linesvariable is changed and first my hook would disable it, then polymode would happily turn it back on.There is a way to work around this by hooking into
org-mode-hookinstead, but it feels too convoluted for me and prone to destabilization.Steps:
Use this minimal init.el:
M-xcopilot-chat-displayC-h vtruncate-lines- it will say that the value ist.Workaround:
Hook into
org-mode-hookinstead and check the buffer name. Also, pray that the buffer name won't change in future releases:Here's my full init.el for reference:
https://bitbucket.org/zalewa/dotfiles/src/2434e8ff09ebfe1d5ec32188eac9eab1cd988b51/.emacs.d/init.el?at=master