(defgroup elemacs-mcfly nil
"Elemacs fly key."
:group 'elemacs)
(defcustom elemacs-mcfly-commands '(consult-line
consult-outline
consult-git-grep
eli/consult-git-grep
consult-ripgrep
my-search-with-chrome
anki-helper-find-notes
eli/silverdict-pop-posframe-toggle
souyun-query-char)
"Commands that need pre-insert candidate."
:group 'elemacs-mcfly
:type '(repeat function))
(defvar elemacs-mcfly-back-commands '(self-insert-command
yank
yank-pop
org-yank))
(defun elemacs-mcfly-back-to-present ()
(remove-hook 'pre-command-hook 'elemacs-mcfly-back-to-present t)
(cond ((and (memq last-command elemacs-mcfly-commands)
(equal (this-command-keys-vector) (kbd "M-p")))
;; repeat one time to get straight to the first history item
(setq unread-command-events
(append unread-command-events
(listify-key-sequence (kbd "M-p")))))
((memq this-command elemacs-mcfly-back-commands)
(delete-region (point) (point-max)))))
(defun elemacs-mcfly-time-travel ()
(when (memq this-command elemacs-mcfly-commands)
(let ((pre-insert-string (with-minibuffer-selected-window
(or (seq-some
(lambda (thing) (thing-at-point thing t))
'(region url))
;; '(symbol url region sexp))
"No thing at point"))))
(save-excursion
(insert (propertize pre-insert-string 'face 'shadow))))
(deactivate-mark)
(add-hook 'pre-command-hook 'elemacs-mcfly-back-to-present nil t)))
;; setup code
(add-hook 'minibuffer-setup-hook #'elemacs-mcfly-time-travel)
抄了段代码 运作良好
有个问题就是 当我有选中区域的时候 打开consult-line 然后在候选列表里移动的时候 选中区域就会被 一起移动 拉得很长
怎么取消这个选中区域 加上了 (deactivate-mark)好像也没有用