diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-05 16:31:48 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-05 16:32:04 -0200 |
commit | cbd587f6fdcd9936132972e510d4cbd973d3a703 (patch) | |
tree | 67308fc900c00a3497fc2d0bdc16055fba3e4f0f /sx-compose.el | |
parent | e061fb947a02290314be7247d81963e7bfd0987b (diff) |
Add sx-compose--is-question-p variable
Diffstat (limited to 'sx-compose.el')
-rw-r--r-- | sx-compose.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sx-compose.el b/sx-compose.el index 0e5e35f..db76531 100644 --- a/sx-compose.el +++ b/sx-compose.el @@ -82,6 +82,10 @@ Is invoked between `sx-compose-before-send-hook' and "Headers inserted when composing a new question. Used by `sx-compose-create'.") +(defvar sx-compose--is-question-p nil + "Non-nil if this `sx-compose-mode' buffer is a question.") +(make-variable-buffer-local 'sx-compose--is-question-p) + (defvar sx-compose--site nil "Site which the curent compose buffer belongs to.") (make-variable-buffer-local 'sx-compose--site) @@ -95,8 +99,11 @@ just implements some extra features related to posting to the API. This mode won't function if `sx-compose--send-function' isn't -set. To make sure you set it correctly, you can create the buffer -with the `sx-compose-create' function. +set. To make sure you set it correctly, you can create the +buffer with the `sx-compose-create' function. + +If creating a question draft, the `sx-compose--is-question-p' +variable should also be set to enable more functionality. \\<sx-compose-mode> \\{sx-compose-mode}" @@ -109,7 +116,7 @@ with the `sx-compose-create' function. (define-key sx-compose-mode-map "\C-c\C-k" #'sx-compose-quit) (sx--define-conditional-key sx-compose-mode-map "\C-c\C-q" #'sx-compose-insert-tags - (ignore-errors (string= "Title: " (substring (buffer-string) 0 7)))) + sx-compose--is-question-p) (defun sx-compose-send () "Finish composing current buffer and send it. @@ -204,6 +211,7 @@ respectively added locally to `sx-compose-before-send-hook' and (with-current-buffer (sx-compose--get-buffer-create site parent) (sx-compose-mode) (setq sx-compose--site site) + (setq sx-compose--is-question-p is-question) (setq sx-compose--send-function (if (consp parent) (sx-assoc-let parent |