Initial quotes support
This commit is contained in:
parent
1ac8f13eec
commit
7344cc325f
|
@ -191,7 +191,6 @@
|
||||||
|
|
||||||
(defun edit-answer-without-quote (id msg-hash)
|
(defun edit-answer-without-quote (id msg-hash)
|
||||||
"Answer to message with ID MSG-HASH."
|
"Answer to message with ID MSG-HASH."
|
||||||
msg-hash
|
|
||||||
(let (answer-hash p)
|
(let (answer-hash p)
|
||||||
(setq answer-hash (get-answers-hash id msg-hash))
|
(setq answer-hash (get-answers-hash id msg-hash))
|
||||||
(switch-to-buffer (get-buffer-create (concat "*IDEC: answer to " id "*")))
|
(switch-to-buffer (get-buffer-create (concat "*IDEC: answer to " id "*")))
|
||||||
|
@ -208,6 +207,33 @@
|
||||||
(goto-char p)
|
(goto-char p)
|
||||||
(idec)))
|
(idec)))
|
||||||
|
|
||||||
|
(defun idec-answers-edit-answer-with-quote (id msg-hash)
|
||||||
|
"Answer to message with quoted body with ID, MSG-HASH and BODY."
|
||||||
|
(let (answer-hash p)
|
||||||
|
(setq answer-hash (get-answers-hash id msg-hash))
|
||||||
|
(switch-to-buffer (get-buffer-create (concat "*IDEC: answer to " id "*")))
|
||||||
|
|
||||||
|
(insert (make-answer-header id msg-hash))
|
||||||
|
(forward-line)
|
||||||
|
(add-text-properties (point) (point-min) 'read-only)
|
||||||
|
(setq p (point))
|
||||||
|
|
||||||
|
(defun insert-quote (head tail)
|
||||||
|
"Insert quote with HEAD and TAIL."
|
||||||
|
(insert "> ") (insert head) (insert "\n")
|
||||||
|
(when (> (length tail) 0)
|
||||||
|
(message "%S" tail)
|
||||||
|
(insert-quote (car tail) (cdr tail))))
|
||||||
|
|
||||||
|
(insert-quote (car (get-message-field (gethash "content" msg-hash) "body"))
|
||||||
|
(cdr (get-message-field (gethash "content" msg-hash) "body")))
|
||||||
|
(insert "\n")
|
||||||
|
(insert-text-button "[Send]"
|
||||||
|
'action (lambda (x) (send-reply-message (button-get x 'msg)))
|
||||||
|
'msg answer-hash)
|
||||||
|
(goto-char p))
|
||||||
|
(idec))
|
||||||
|
|
||||||
;; END OF ANSWERS
|
;; END OF ANSWERS
|
||||||
|
|
||||||
;; NEW MESSAGE
|
;; NEW MESSAGE
|
||||||
|
|
20
idec.el
20
idec.el
|
@ -109,10 +109,15 @@ put cursor to CHECKPOINT."
|
||||||
(insert-button "Answer"
|
(insert-button "Answer"
|
||||||
'action (lambda (x) (edit-answer-without-quote (button-get x 'id) (button-get x 'msg-hash)))
|
'action (lambda (x) (edit-answer-without-quote (button-get x 'id) (button-get x 'msg-hash)))
|
||||||
'id (gethash "id" msg)
|
'id (gethash "id" msg)
|
||||||
'msg-hash answer-hash))
|
'msg-hash answer-hash)
|
||||||
(princ "]")
|
(princ "]")
|
||||||
(princ "\t [")
|
(princ "\t [")
|
||||||
(insert-button "Quote answer")
|
(insert-button "Quoted answer"
|
||||||
|
'action (lambda (x) (idec-answers-edit-answer-with-quote
|
||||||
|
(button-get x 'id)
|
||||||
|
(button-get x 'msg-hash)))
|
||||||
|
'id (gethash "id" msg)
|
||||||
|
'msg-hash answer-hash))
|
||||||
(princ "]")
|
(princ "]")
|
||||||
(add-text-properties start (point) 'read-only))
|
(add-text-properties start (point) 'read-only))
|
||||||
(idec))
|
(idec))
|
||||||
|
@ -151,14 +156,17 @@ put cursor to CHECKPOINT."
|
||||||
(insert-button "Answer"
|
(insert-button "Answer"
|
||||||
'action (lambda (x) (edit-answer-without-quote (button-get x 'id) (button-get x 'msg-hash)))
|
'action (lambda (x) (edit-answer-without-quote (button-get x 'id) (button-get x 'msg-hash)))
|
||||||
'id (gethash "id" msg)
|
'id (gethash "id" msg)
|
||||||
'msg-hash answer-hash))
|
'msg-hash answer-hash)
|
||||||
(princ "]")
|
(princ "]")
|
||||||
(princ (concat (make-string 6 ? ) "["))
|
(princ (concat (make-string 9 ? ) "["))
|
||||||
(insert-button "Quote answer")
|
(insert-button "Quoted answer"
|
||||||
|
'action (lambda (x) (idec-answers-edit-answer-with-quote (button-get x 'id) (button-get x 'msg-hash)))
|
||||||
|
'id (gethash "id" msg)
|
||||||
|
'msg-hash answer-hash))
|
||||||
(princ "]")
|
(princ "]")
|
||||||
(add-text-properties (point-min) (point-max) 'read-only))
|
(add-text-properties (point-min) (point-max) 'read-only))
|
||||||
(point-max)
|
(point-max)
|
||||||
(idec-mode))
|
(idec))
|
||||||
|
|
||||||
(defun display-new-messages ()
|
(defun display-new-messages ()
|
||||||
"Display new fetched messages from `new-messages-list'."
|
"Display new fetched messages from `new-messages-list'."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user