refactor(evil): replace evil-visual-update-x-selection advice

With the new evil-visual-update-x-selection-p setting.

Also adds a more descriptive comment to this design choice.
This commit is contained in:
Henrik Lissner 2022-08-09 18:09:26 +02:00
parent bd597ffda4
commit 118f0c416a
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -63,11 +63,15 @@ directives. By default, this only recognizes C directives.")
:config :config
(evil-select-search-module 'evil-search-module 'evil-search) (evil-select-search-module 'evil-search-module 'evil-search)
;; stop copying each visual state move to the clipboard: ;; PERF: Stop copying the selection to the clipboard each time the cursor
;; https://github.com/emacs-evil/evil/issues/336 ;; moves in visual mode. Why? Because on most non-X systems (and in terminals
;; grokked from: ;; with clipboard plugins like xclip.el active), Emacs will spin up a new
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro ;; process to communicate with the clipboard for each movement. On Windows,
(advice-add #'evil-visual-update-x-selection :override #'ignore) ;; older versions of macOS (pre-vfork), and Waylang (without pgtk), this is
;; super expensive and can lead to freezing and/or zombie processes.
;;
;; UX: It also clobbers clipboard managers (see emacs-evil/evil#336).
(setq evil-visual-update-x-selection-p nil)
;; Start help-with-tutorial in emacs state ;; Start help-with-tutorial in emacs state
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1))) (advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))