diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-02 01:48:55 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-02 01:48:55 +0000 |
commit | 89a45e4724089a8bfdecaa6f58ae5394c10d85e3 (patch) | |
tree | 6ab18b3828866c3adaa20b58155f55835e805b6b /sx-compose.el | |
parent | 1174858c8f7e87546e671c7322850e2c9e22de4d (diff) |
Fix up asking logic
Diffstat (limited to 'sx-compose.el')
-rw-r--r-- | sx-compose.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sx-compose.el b/sx-compose.el index dcb1bb0..0ae1f93 100644 --- a/sx-compose.el +++ b/sx-compose.el @@ -61,9 +61,11 @@ Is invoked between `sx-compose-before-send-hook' and (concat #("Title: " 0 7 (intangible t read-only t rear-nonsticky t)) #("\n" 0 1 (read-only t)) - #("Tags: " 0 7 (read-only t intangible t rear-nonsticky t)) - #("\n----------------------------------------\n" - 0 42 (read-only t))) + #("Tags : " 0 7 (read-only t intangible t rear-nonsticky t)) + #("\n" 0 1 (read-only t rear-nonsticky t)) + #("________________________________________\n\n" + 0 42 (read-only t rear-nonsticky t intangible t + sx-compose-separator t))) "Headers inserted when composing a new question. Used by `sx-compose--create'.") @@ -188,21 +190,24 @@ other keywords are read from the header " keywords) ;; Read the Title. (goto-char (point-min)) - (when (search-forward-regexp "^Title: *\\(.*\\) *$" header-end 'noerror) + (unless (search-forward-regexp + "^Title: *\\(.*\\) *$" header-end 'noerror) (error "No Title header found")) (push (cons 'title (match-string 1)) keywords) ;; And the tags (goto-char (point-min)) - (unless (search-forward-regexp "^Tags: *\\([^[:space:]].*\\) *$" header-end 'noerror) + (unless (search-forward-regexp "^Tags : *\\([^[:space:]].*\\) *$" + header-end 'noerror) (error "No Tags header found")) - (push (cons 'tags (replace-regexp-in-string - "[[:space:],]" ";" (match-string 1))) + (push (cons 'tags (split-string (match-string 1) "[[:space:],;]" + 'omit-nulls "[[: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)))) + header-end 'sx-compose-separator)) + keywords)) (body . ,(buffer-string)))) (defun sx-compose--get-buffer-create (site data) |