@@ -57,45 +57,18 @@ Argument COMMAND is required in sideline backend."
5757(defun chatgpt-sideline--on-action (candidate &rest _ )
5858 " React to action when CANDIDATE is clicked."
5959 (pcase candidate
60- (" 📝 Edit" )
61- (" 📋 Copy" (kill-new (chatgpt-sideline--current-content)))))
62-
63- (defun chatgpt-sideline--current-chat-point ()
64- " Return current chat point."
65- (let ((chat-point))
66- (cl-some (lambda (pt )
67- (when (<= pt (point ))
68- (setq chat-point pt)))
69- chatgpt-chat-points)
70- chat-point))
71-
72- (defun chatgpt-sideline--chat-point-index (chat-point )
73- " Return CHAT-POINT's index."
74- (cl-position chat-point (chatgpt-chat-points)))
75-
76- (defun chatgpt-sideline--current-message ()
77- " Return current message."
78- (let* ((chat-point (chatgpt-sideline--current-chat-point))
79- (index (chatgpt-sideline--chat-point-index chat-point)))
80- (elt chatgpt-chat-history index)))
81-
82- (defun chatgpt-sideline--current-content ()
83- " Return current content."
84- (let ((msg (chatgpt-sideline--current-message)))
85- (alist-get 'content msg)))
86-
87- (defun chatgpt-sideline--current-role ()
88- " Return current role."
89- (let ((msg (chatgpt-sideline--current-message)))
90- (alist-get 'role msg)))
60+ (" 📝 Edit" (chatgpt-edit-start chatgpt-instance))
61+ (" 📋 Copy"
62+ (kill-new (chatgpt-current-content))
63+ (let ((message-log-max )) (message " Copied! " )))))
9164
9265(defun chatgpt-sideline--editable-p ()
9366 " Return non-nil when current section is ediatble."
94- (string= (chatgpt-user) (chatgpt-sideline-- current-role)))
67+ (string= (chatgpt-user) (chatgpt-current-role)))
9568
9669(defun chatgpt-sideline--copyable-p ()
9770 " Return non-nil when current section is copyable."
98- (not (string= (chatgpt-user) (chatgpt-sideline-- current-role))))
71+ (not (string= (chatgpt-user) (chatgpt-current-role))))
9972
10073(defun chatgpt-sideline--show (callback &rest _ )
10174 " Execute CALLBACK to display with sideline."
0 commit comments