Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit32f93b8

Browse files
committed
fix: make code compatible with emacs-28
1 parent9e10c1b commit32f93b8

File tree

2 files changed

+43
-22
lines changed

2 files changed

+43
-22
lines changed

‎clients/lsp-copilot.el‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The input are the file name and the major mode of the buffer."
175175
("C-<return>". lsp-copilot--panel-accept-suggestion-at-point)
176176
("q". quit-window))))
177177
(dolist (binding key-bindings)
178-
(bind-key (kbd (car binding)) (cdr binding)'lsp-copilot-panel-buffer-mode-map)))
178+
(define-keylsp-copilot-panel-buffer-mode-map(kbd (car binding)) (cdr binding))))
179179

180180

181181
(defcustomlsp-copilot-panel-display-fn#'pop-to-buffer
@@ -234,7 +234,7 @@ The input are the file name and the major mode of the buffer."
234234
(put-text-property start-point (point)'lsp-panel-item item)
235235
(put-text-property start-point (point)'lsp-panel-completing-buffer-name completing-buffer-name)))
236236

237-
(delete-all-spacet)
237+
(lsp-delete-all-spacet)
238238
(lsp-copilot-panel-buffer-mode)
239239
(read-only-mode+1)
240240

@@ -258,7 +258,7 @@ The input are the file name and the major mode of the buffer."
258258

259259
(defunlsp-copilot--panel-completions-progress-handler (_params)
260260
(-let* (((&ProgressParams:token:value) params)
261-
((action completing-buffer-name panel-completion-token) (string-splittoken" ///" )))
261+
((action completing-buffer-name panel-completion-token) (s-split" ///"token)))
262262
(pcase action
263263
;; copilot sends results in the report
264264
("PANEL-PARTIAL-RESULT"

‎lsp-mode.el‎

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,30 +1429,51 @@ Symlinks are not followed."
14291429

14301430
;; compat
14311431
(if (version< emacs-version "29.1")
1432-
;; Undo macro probably introduced in 29.1
1433-
(defmacro lsp-with-undo-amalgamate (&rest body)
1434-
"Like `progn' but perform BODY with amalgamated undo barriers.
1432+
(progn
1433+
;; Undo macro probably introduced in 29.1
1434+
(defmacro lsp-with-undo-amalgamate (&rest body)
1435+
"Like `progn' but perform BODY with amalgamated undo barriers.
14351436

14361437
This allows multiple operations to be undone in a single step.
14371438
When undo is disabled this behaves like `progn'."
1438-
(declare (indent 0) (debug t))
1439-
(let ((handle (make-symbol "--change-group-handle--")))
1440-
`(let ((,handle (prepare-change-group))
1441-
;; Don't truncate any undo data in the middle of this,
1442-
;; otherwise Emacs might truncate part of the resulting
1443-
;; undo step: we want to mimic the behavior we'd get if the
1444-
;; undo-boundaries were never added in the first place.
1445-
(undo-outer-limit nil)
1446-
(undo-limit most-positive-fixnum)
1447-
(undo-strong-limit most-positive-fixnum))
1448-
(unwind-protect
1439+
(declare (indent 0) (debug t))
1440+
(let ((handle (make-symbol "--change-group-handle--")))
1441+
`(let ((,handle (prepare-change-group))
1442+
;; Don't truncate any undo data in the middle of this,
1443+
;; otherwise Emacs might truncate part of the resulting
1444+
;; undo step: we want to mimic the behavior we'd get if the
1445+
;; undo-boundaries were never added in the first place.
1446+
(undo-outer-limit nil)
1447+
(undo-limit most-positive-fixnum)
1448+
(undo-strong-limit most-positive-fixnum))
1449+
(unwind-protect
1450+
(progn
1451+
(activate-change-group ,handle)
1452+
,@body)
14491453
(progn
1450-
(activate-change-group ,handle)
1451-
,@body)
1454+
(accept-change-group ,handle)
1455+
(undo-amalgamate-change-group ,handle))))))
1456+
1457+
;; delete-all-space function introduced in 29
1458+
(defun lsp-delete-all-space (&optional backward-only)
1459+
"Delete all spaces, tabs, and newlines around point.
1460+
If BACKWARD-ONLY is non-nil, delete them only before point."
1461+
(interactive "*P")
1462+
(let ((chars " \t\r\n")
1463+
(orig-pos (point)))
1464+
(delete-region
1465+
(if backward-only
1466+
orig-pos
14521467
(progn
1453-
(accept-change-group ,handle)
1454-
(undo-amalgamate-change-group ,handle))))))
1455-
(defalias 'lsp-with-undo-amalgamate 'with-undo-amalgamate))
1468+
(skip-chars-forward chars)
1469+
(constrain-to-field nil orig-pos t)))
1470+
(progn
1471+
(skip-chars-backward chars)
1472+
(constrain-to-field nil orig-pos))))))
1473+
;;29.1+
1474+
(defalias 'lsp-with-undo-amalgamate 'with-undo-amalgamate)
1475+
(defalias 'lsp-delete-all-space 'delete-all-space))
1476+
14561477

14571478
(defun lsp--merge-results (results method)
14581479
"Merge RESULTS by filtering the empty hash-tables and merging

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp