@@ -104,6 +104,26 @@ The input are the file name and the major mode of the buffer."
104
104
(defvar-local lsp-copilot-panel-completion-items nil
105
105
" A list of completion items returned by the Panel Completion call" )
106
106
107
+ (if (version< emacs-version " 29.0" )
108
+ ; ; Backport from emacs 29
109
+ (defun lsp-copilot-panel--delete-all-space (&optional backward-only )
110
+ " Delete all spaces, tabs, and newlines around point.
111
+ If BACKWARD-ONLY is non-nil, delete them only before point."
112
+ (interactive " *P" )
113
+ (let ((chars " \t\r\n " )
114
+ (orig-pos (point )))
115
+ (delete-region
116
+ (if backward-only
117
+ orig-pos
118
+ (progn
119
+ (skip-chars-forward chars)
120
+ (constrain-to-field nil orig-pos t )))
121
+ (progn
122
+ (skip-chars-backward chars)
123
+ (constrain-to-field nil orig-pos)))))
124
+ (defalias 'lsp-copilot-panel--delete-all-space 'delete-all-space ))
125
+
126
+
107
127
(defvar-local lsp-copilot-panel-completion-token nil
108
128
" The per-request token" )
109
129
@@ -175,7 +195,7 @@ The input are the file name and the major mode of the buffer."
175
195
(" C-<return>" . lsp-copilot--panel-accept-suggestion-at-point)
176
196
(" q" . quit-window))))
177
197
(dolist (binding key-bindings)
178
- (bind -key (kbd (car binding)) (cdr binding) 'lsp-copilot-panel-buffer-mode-map )))
198
+ (define -key lsp-copilot-panel-buffer-mode-map (kbd (car binding)) (cdr binding))))
179
199
180
200
181
201
(defcustom lsp-copilot-panel-display-fn #'pop-to-buffer
@@ -234,7 +254,7 @@ The input are the file name and the major mode of the buffer."
234
254
(put-text-property start-point (point ) 'lsp-panel-item item)
235
255
(put-text-property start-point (point ) 'lsp-panel-completing-buffer-name completing-buffer-name)))
236
256
237
- (delete-all-space t )
257
+ (lsp-copilot-panel-- delete-all-space t )
238
258
(lsp-copilot-panel-buffer-mode)
239
259
(read-only-mode +1 )
240
260
@@ -258,7 +278,7 @@ The input are the file name and the major mode of the buffer."
258
278
259
279
(defun lsp-copilot--panel-completions-progress-handler (_ params )
260
280
(-let* (((&ProgressParams :token :value ) params)
261
- ((action completing-buffer-name panel-completion-token) (string -split token " /// " )))
281
+ ((action completing-buffer-name panel-completion-token) (s -split " /// " token )))
262
282
(pcase action
263
283
; ; copilot sends results in the report
264
284
(" PANEL-PARTIAL-RESULT"
0 commit comments