[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ellama cfd60ca420 3/4: Merge pull request #41 from Steb
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ellama cfd60ca420 3/4: Merge pull request #41 from Stebalien/steb/optional-paragraph-filling |
Date: |
Wed, 27 Dec 2023 09:57:50 -0500 (EST) |
branch: externals/ellama
commit cfd60ca420fe2e40bdb7fd94c6b2f0d467669a60
Merge: 70671ca662 8ebd5ee12d
Author: Sergey Kostyaev <s-kostyaev@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Merge pull request #41 from Stebalien/steb/optional-paragraph-filling
Make it possible to customize paragraph filling behavior
---
ellama.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/ellama.el b/ellama.el
index de83b3eb49..f33476bb65 100644
--- a/ellama.el
+++ b/ellama.el
@@ -155,6 +155,15 @@
:type 'boolean
:group 'ellama)
+(defcustom ellama-fill-paragraphs '(text-mode)
+ "When to wrap paragraphs."
+ :group 'ellama
+ :type `(choice
+ (const :tag "Never fill paragraphs" nil)
+ (const :tag "Always fill paragraphs" t)
+ (function :tag "By predicate")
+ (repeat :tag "In specific modes" (symbol))))
+
(defvar-local ellama--chat-prompt nil)
(defvar-local ellama--change-group nil)
@@ -227,8 +236,11 @@ when the request completes (with BUFFER current)."
(goto-char start)
(delete-region start end)
(insert (funcall filter text))
- (when (not (derived-mode-p 'prog-mode))
- (fill-region start (point)))
+ (when (pcase ellama-fill-paragraphs
+ ((cl-type function) (funcall
ellama-fill-paragraphs))
+ ((cl-type boolean) ellama-fill-paragraphs)
+ ((cl-type list) (apply #'derived-mode-p
ellama-fill-paragraphs)))
+ (fill-region start (point)))
(goto-char pt))
(when-let ((ellama-auto-scroll)
(window (get-buffer-window buffer)))