把 C-e 绑定到 (or (copilot 补全) (原本的 C-e 函数)) 后,按住 shift C-e 不能选择文字

;;;###autoload
(defun copilot-accept-or-forward ()
  "Accept copilot completion or jumps"
  (interactive)
  (or (copilot-accept-completion)
      (doom/forward-to-last-non-comment-or-eol)))

(use-package! copilot
  :bind
  (:map copilot-mode-map
   ("C-e" . 'copilot-accept-or-forward)
   ("M-n" . 'copilot-next-completion)
   ("M-p" . 'copilot-previous-completion))
  :config
  (global-copilot-mode 1))

(after! acm
  (map!
   :map acm-mode-map
   "M-n" nil
   "M-p" nil))

按住 shift,C-e 只会跳转到末尾,不会选择该段文字。

试过把 doom/forward-to-last-non-comment-or-eol 换成原始的 end-of-line,仍然如此。

 ;;;###autoload
 (defun copilot-accept-or-forward ()
   "Accept copilot completion or jumps"
-  (interactive)
+  (interactive "^")
    (or (copilot-accept-completion)
       (doom/forward-to-last-non-comment-or-eol)))

interactive 文档提示

If the string begins with ^ and shift-select-mode is non-nil,
 Emacs first calls the function handle-shift-selection.
1 个赞