Open iT-Boyer opened 1 year ago
The same is true of org babel src blocks I believe. Not sure if this is something that org-ai
can fix, it seems like an issue with org-mode
/ org-indent-mode
One workaround you can add to your config:
(add-hook #'org-ai-after-chat-insertion-hook
(lambda (_ _)
(when (eq major-mode 'org-mode)
(org-indent-indent-buffer))))
@rksm your workaround works for small files but slows Emacs to a crawl in larger ones.
Maybe it would help to have a specific hook for after the full chat response is inserted here?
I think the simpler option is to use the first argument to customize the behavior:
(add-hook #'org-ai-after-chat-insertion-hook
(lambda (what _)
(when (and (eq what 'end)
(eq major-mode 'org-mode))
(org-indent-indent-buffer))))
I've been using a similar hook, but with an additional check to see if org-indent-mode is active: https://github.com/rksm/org-ai/issues/18#issuecomment-1737931580. A more efficient approach would use (org-indent-refresh-maybe beg end _)
which is intended to be called from things like after-change-functions
.
Indentation issue in org-ai: After executing a dialogue, newly added lines by [AI] are not aligned with the content above. For example:
layout of newly added content after executing a request: