branch: externals/ellama
commit eafcfe7e01deaf01a0fbec0a14f18fc232223a5d
Author: Sergey Kostyaev <sskosty...@gmail.com>
Commit: Sergey Kostyaev <sskosty...@gmail.com>

    Add proofreading functionality
    
    Added new command `ellama-proofread` to proofread selected text or
    buffer. Updated keybindings and documentation accordingly.
---
 README.org |  5 +++++
 ellama.el  | 15 +++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/README.org b/README.org
index f5ca823e3f..f4c0ab7a64 100644
--- a/README.org
+++ b/README.org
@@ -202,6 +202,10 @@ provided change using Ellama.
 
 Generate commit message based on diff.
 
+*** ellama-proofread
+
+Proofread selected text.
+
 *** ellama-improve-wording
 
 Enhance the wording in the currently selected region or buffer using Ellama.
@@ -297,6 +301,7 @@ Ellama, using the ~ellama-keymap-prefix~ prefix (not set by 
default):
 | "s r"  | ellama-session-rename           | Session rename               |
 | "s d"  | ellama-session-remove           | Session delete               |
 | "s a"  | ellama-session-switch           | Session activate             |
+| "P"    | ellama-proofread                | Proofread                    |
 | "i w"  | ellama-improve-wording          | Improve wording              |
 | "i g"  | ellama-improve-grammar          | Improve grammar and spelling |
 | "i c"  | ellama-improve-conciseness      | Improve conciseness          |
diff --git a/ellama.el b/ellama.el
index 746c7b127c..519c432526 100644
--- a/ellama.el
+++ b/ellama.el
@@ -134,6 +134,7 @@
     (define-key map (kbd "i w") 'ellama-improve-wording)
     (define-key map (kbd "i g") 'ellama-improve-grammar)
     (define-key map (kbd "i c") 'ellama-improve-conciseness)
+    (define-key map (kbd "P") 'ellama-proofread)
     ;; make
     (define-key map (kbd "m l") 'ellama-make-list)
     (define-key map (kbd "m t") 'ellama-make-table)
@@ -268,6 +269,11 @@ You are a summarizer. You write a summary of the input 
**IN THE SAME LANGUAGE AS
   :group 'ellama
   :type 'string)
 
+(defcustom ellama-proofread-prompt-template "proofread"
+  "Prompt template for `ellama-proofread'."
+  :group 'ellama
+  :type 'string)
+
 (defcustom ellama-improve-conciseness-prompt-template "make it as simple and 
concise as possible"
   "Prompt template for `ellama-improve-conciseness'."
   :group 'ellama
@@ -2225,6 +2231,14 @@ prefix (\\[universal-argument]), prompt the user to 
amend the template."
   (interactive "p")
   (ellama-change ellama-improve-wording-prompt-template edit-template))
 
+;;;###autoload
+(defun ellama-proofread (&optional edit-template)
+  "Proofread the currently selected region or buffer.
+When the value of EDIT-TEMPLATE is 4, or with one `universal-argument' as
+prefix (\\[universal-argument]), prompt the user to amend the template."
+  (interactive "p")
+  (ellama-change ellama-proofread-prompt-template edit-template))
+
 ;;;###autoload
 (defun ellama-improve-conciseness (&optional edit-template)
   "Make the text of the currently selected region or buffer concise and simple.
@@ -2549,6 +2563,7 @@ Call CALLBACK on result list of strings.  ARGS contains 
keys for fine control.
   "Main Menu."
   [["Main"
     ("c" "Chat" ellama-chat)
+    ("P" "Proofread" ellama-proofread)
     ("a" "Ask Commands" ellama-transient-ask-menu)
     ("C" "Code Commands" ellama-transient-code-menu)]]
   [["Text"

Reply via email to