From 62e8ced2af638f3646ae53b0472b4ec3284a9cc7 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 8 Mar 2015 19:21:49 -0300 Subject: Don't erase question headers when sending. Fix #271 --- sx-compose.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sx-compose.el b/sx-compose.el index ae13fb6..e3f9c00 100644 --- a/sx-compose.el +++ b/sx-compose.el @@ -294,15 +294,14 @@ Keywords meant to be used in `sx-method-call'. `body' is read as the `buffer-string'. If IS-QUESTION is non-nil, other keywords are read from the header " + (goto-char (point-min)) `(,@(when is-question (let ((inhibit-point-motion-hooks t) - (inhibit-read-only t) (header-end (next-single-property-change (point-min) 'sx-compose-separator)) keywords) ;; Read the Title. - (goto-char (point-min)) (unless (search-forward-regexp "^Title: *\\(.*\\) *$" header-end 'noerror) (error "No Title header found")) @@ -314,13 +313,11 @@ other keywords are read from the header " (error "No Tags header found")) (push (cons 'tags (sx--split-string (match-string 1) "[[:space:],;]")) keywords) - ;; And erase the header so it doesn't get sent. - (delete-region - (point-min) - (next-single-property-change - header-end 'sx-compose-separator)) + ;; And move past the header so it doesn't get sent. + (goto-char (next-single-property-change + header-end 'sx-compose-separator)) keywords)) - (body . ,(buffer-string)))) + (body . ,(buffer-substring-no-properties (point) (point-max))))) (defun sx-compose--get-buffer-create (site data) "Get or create a buffer for use with `sx-compose-mode'. -- cgit v1.2.3