Skip to content

Commit 2bb00cf

Browse files
committed
Use built-in
1 parent e57f06b commit 2bb00cf

File tree

2 files changed

+8
-33
lines changed

2 files changed

+8
-33
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# chatgpt-sideline
55
> Sideline support for chatgpt
66
7+
[![CI](https://github.com/emacs-openai/chatgpt-sideline/actions/workflows/test.yml/badge.svg)](https://github.com/emacs-openai/chatgpt-sideline/actions/workflows/test.yml)
8+
79
## 💾 Installation
810

911
#### package.el

chatgpt-sideline.el

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)