From 1ac8f13eec2f1b0cdb954c0852813920b92b0b36 Mon Sep 17 00:00:00 2001 From: Denis Zheleztsov Date: Wed, 8 Aug 2018 09:37:36 +0300 Subject: [PATCH] Fixed `Not enough arguments for format string` error --- idec-answers.el | 15 ++++++--------- idec-mode.el | 5 +++-- idec.el | 3 ++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/idec-answers.el b/idec-answers.el index 1e38995..b2a65b0 100644 --- a/idec-answers.el +++ b/idec-answers.el @@ -54,7 +54,7 @@ (defun base64url-encode-string (str) "Decode base64 urlsafe string STR." (message (concat "Base64url: " (base64-to-base64url (base64-encode-string str t)))) - (base64-to-base64url (base64-encode-string str t))) + (base64-to-base64url (base64-encode-string str nil))) (defun base64url-decode-string (str) "Encode base64 urlsafe string STR." @@ -64,16 +64,16 @@ "Return url with `idec-primary-node' to send messages." (concat idec-primary-node "u/point")) -(defun request-is-done (result) - "Show message with RESULT code." - (message "IDEC: Sended. Result: %S" result)) +(defun request-is-done () + "Show message." + (message "IDEC: Message sended.")) (defun do-post-request (url msg) "Make POST request to URL with data MSG." (message (gethash 'tmsg msg)) (web-http-post (lambda (con header data) - (request-is-done data)) + (request-is-done)) :url url :data msg ) @@ -90,7 +90,7 @@ (defun post-message (encoded-message) "Do POST request to `idec-primary-node' with Base64 ENCODED-MESSAGE." - (message (base64url-decode-string encoded-message)) + ;; (message (base64url-decode-string encoded-message)) (let (json) (setq json (make-hash-table :test 'equal)) (puthash 'pauth idec-account-auth json) @@ -112,7 +112,6 @@ 'utf-8) msg) (puthash "echo" echo msg) - (do-send-new-post-request msg))) (defun do-send-new-post-request (msg) @@ -129,7 +128,6 @@ (defun do-send-reply-post-request (message) "Make IDEC compatible point MESSAGE and send it to `idec-primary-node'." - (message (gethash "body" message)) (let (point-message) (setq point-message (list (gethash "echo" message) @@ -148,7 +146,6 @@ (puthash "body" (s-join "\n" (-drop-last 1 (-drop 4 (split-string (buffer-string) "\n")))) msg) - (message (gethash "body" msg)) (do-send-reply-post-request msg)) (defun get-answers-hash (id msg-hash) diff --git a/idec-mode.el b/idec-mode.el index 8632c99..f173f08 100644 --- a/idec-mode.el +++ b/idec-mode.el @@ -282,8 +282,8 @@ optionaly return cursor to CHECKPOINT." (setq longest (+ 1 (longest-local-echo-subj echo))) (with-output-to-temp-buffer (get-buffer-create (concat "*IDEC: INBOX->(" echo ")") ) (switch-to-buffer (concat "*IDEC: INBOX->(" echo ")")) - (let (counter) - (setq counter 0) + (let (start) + (setq start (point)) (dolist (msg (get-echo-messages echo)) (setq subj-length (length (gethash "subj" msg))) (insert-button (gethash "subj" msg) @@ -302,6 +302,7 @@ optionaly return cursor to CHECKPOINT." (princ (make-string (- longest subj-length) ? )) (princ (concat " " (gethash "time" msg))) (princ (concat "\t" (gethash "author" msg) "\n"))) + (add-text-properties start (point) 'read-only) (idec-mode))))) diff --git a/idec.el b/idec.el index 8400ed7..678ab9a 100644 --- a/idec.el +++ b/idec.el @@ -97,6 +97,7 @@ put cursor to CHECKPOINT." (mark-message-read (gethash "id" msg) (gethash "echo" msg)) (with-output-to-temp-buffer (get-buffer-create (concat "*IDEC: " (gethash "subj" msg) "*")) (switch-to-buffer (concat "*IDEC: " (gethash "subj" msg) "*")) + (setq start (point)) (princ (make-message-header msg)) (princ (concat "__________________________________\n\n" (replace-in-string "\r" "" (gethash "body" msg)))) @@ -113,7 +114,7 @@ put cursor to CHECKPOINT." (princ "\t [") (insert-button "Quote answer") (princ "]") - (add-text-properties (point-min) (point-max) 'read-only)) + (add-text-properties start (point) 'read-only)) (idec)) (defun display-message (msg)