From 9d86d76e96ab19032db9fd63e61488a7847a5f1d Mon Sep 17 00:00:00 2001 From: Christophe Gouel Date: Sat, 18 Oct 2025 17:46:20 +0200 Subject: [PATCH] Adjust the marking of paragraphs in chatgpt-shell-proofread-paragraph-or-region --- chatgpt-shell.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chatgpt-shell.el b/chatgpt-shell.el index 9b66f0c..52f1459 100644 --- a/chatgpt-shell.el +++ b/chatgpt-shell.el @@ -1415,9 +1415,15 @@ See `chatgpt-shell-prompt-header-proofread-region' to change prompt or language. (let* ((region (if (use-region-p) (chatgpt-shell--region) (save-excursion - (mark-paragraph) - ;; Adjust end to avoid including the newline character after the paragraph - (let ((start (region-beginning)) + ;; Mark the current paragraph or org element, because org + ;; defines paragraphs differently from other text modes + (if (derived-mode-p 'org-mode) + (org-mark-element) + (mark-paragraph)) + ;; Adjust start and end to avoid including newline characters + (let ((start (progn (goto-char (region-beginning)) + (skip-chars-forward "\n") + (point))) (end (progn (goto-char (region-end)) (skip-chars-backward "\n") (point))))