Commit Diff
Diff:
28d59ae943de01aa2ff790776c0a3c078fb7bc7d
b0b27a56092b403a6813973ec2e38f89d122c315
Commit:
b0b27a56092b403a6813973ec2e38f89d122c315
Tree:
0ac879d696327f5e45afa087ba8c50adc7f081c9
Author:
Omar Polo <op@omarpolo.com>
Date:
Sun Feb 28 18:41:01 2021 UTC
Message:
improve chat appearance
commit - 28d59ae943de01aa2ff790776c0a3c078fb7bc7d
commit + b0b27a56092b403a6813973ec2e38f89d122c315
blob - 06bc9a870bdbb895739cd84a8e2caa32ace62d57
blob + a4f9d70a2966128f8d6f7a6941c2daecbc77391a
--- toxe-chat.el
+++ toxe-chat.el
@@ -22,6 +22,7 @@
;;; Code:
+(require 'cl-lib)
(require 'ewoc)
;; iimage for inline images?
@@ -43,6 +44,11 @@
(defvar-local toxe-chat-ewoc nil
"EWOC data for the current toxe chatbuf.")
+(defun toxe-chat--ewoc-pp (data)
+ "Pretty print DATA (for EWOC)."
+ (cl-destructuring-bind (from msg) data
+ (insert from ":\t" msg)))
+
(defvar toxe-chat-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") #'toxe-chat-send)
@@ -50,20 +56,17 @@
map)
"Keymap for toxe chat buffers.")
-(defun toxe-chat-ewoc-pp (data)
- "Pretty print DATA (for EWOC)."
- (cl-destructuring-bind (from msg) data
- (insert from ":\t" msg)))
+(defvar toxe-chat--pass-friend nil)
(define-derived-mode toxe-chat-mode special-mode "toxe-chat"
"mode for the toxe chatbuf."
(erase-buffer)
(buffer-disable-undo)
- (setq toxe-chat-ewoc
- (ewoc-create #'toxe-chat-ewoc-pp
+ (setq toxe-chat-friend toxe-chat--pass-friend
+ toxe-chat-ewoc
+ (ewoc-create #'toxe-chat--ewoc-pp
(format "Chat with %s\n\n"
- ;; (toxe--friend-name toxe-chat-friend)
- "someone"))))
+ (toxe--friend-name toxe-chat-friend)))))
(defun toxe-chat--insert (from msg)
"Insert the message MSG from the user FROM."
Omar Polo