diff options
author | Sean Allred <code@seanallred.com> | 2014-12-26 17:49:11 -0500 |
---|---|---|
committer | Sean Allred <code@seanallred.com> | 2014-12-26 17:50:19 -0500 |
commit | 0db8321f1dbb827666ef79bdae19b4864cb524ac (patch) | |
tree | ed8eeb818cd78d18b597839fcf25dd843b2b4677 /sx-compose.el | |
parent | 0354bf2c974b13967558187936918db4af125571 (diff) | |
parent | a919c72f2b58d889bf3fbdde100f9912a90c64ab (diff) |
Merge branch 'master' into visit-question-from-link
Conflicts:
sx.el
Conflict arose from 6eb53ee0f12dd9f7d444e6749f6cc55c6db62078
Diffstat (limited to 'sx-compose.el')
-rw-r--r-- | sx-compose.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sx-compose.el b/sx-compose.el index 96f47f3..5201435 100644 --- a/sx-compose.el +++ b/sx-compose.el @@ -117,9 +117,12 @@ contents to the API, then calls `sx-compose-after-send-functions'." (current-buffer) result))))) (defun sx-compose-quit (buffer _) - "Kill BUFFER." + "Close BUFFER's window and kill it." (interactive (list (current-buffer) nil)) (when (buffer-live-p buffer) + (let ((w (get-buffer-window buffer))) + (when (window-live-p w) + (delete-window w))) (kill-buffer buffer))) (defun sx-compose--copy-as-kill (buffer _) @@ -146,19 +149,22 @@ respectively added locally to `sx-compose-before-send-hook' and (error "Invalid PARENT")) (let ((is-question (and (listp parent) - (null (cdr (assoc 'answer_id parent)))))) + (cdr (assoc 'title parent))))) (with-current-buffer (sx-compose--get-buffer-create site parent) (sx-compose-mode) (setq sx-compose--send-function (if (consp parent) (sx-assoc-let parent - (lambda () (sx-method-call (if .title 'questions 'answers) + (lambda () (sx-method-call (cond + (.title 'questions) + (.comment_id 'comments) + (t 'answers)) :auth 'warn :url-method "POST" :filter sx-browse-filter :site site :keywords (sx-compose--generate-keywords is-question) - :id (or .answer_id .question_id) + :id (or .comment_id .answer_id .question_id) :submethod 'edit))) (lambda () (sx-method-call 'questions :auth 'warn @@ -256,8 +262,13 @@ the id property." site data))) (t (get-buffer-create - (format "*sx draft edit %s %s*" - site (sx-assoc-let data (or .answer_id .question_id))))))) + (sx-assoc-let data + (format "*sx draft edit %s %s %s*" + site + (cond (.title "question") + (.comment_id "comment") + (t "answer")) + (or .comment_id .answer_id .question_id))))))) (provide 'sx-compose) ;;; sx-compose.el ends here |