>>> int main() >>> { >>> xyzz = abcc; >>> } >>> >>> 1. Place mouse over `main` and left double click - `main` is selected >>> 2. isearch-forward (C-s) `xyzz` - `xyzz` is selected >>> 3. place cursor over `x` of `xyzz` and mouse-yank-at-click (middle mouse >>> down) >>> >>> You should see error "Lisp nesting exceeds `max-lisp-eval-depth`" >> >> It's an infinite recursion inside isearch-mouse-2. > > This is because let-binding overriding-terminal-local-map to nil > > (let ((overriding-terminal-local-map nil)) > (key-binding (this-command-keys-vector) t)) > > doesn't disable its current value anymore. It used to work when bug#23007 > was fixed in 2017. So in Emacs 26.3 it correctly returned 'mouse-yank-primary', > but in Emacs 27 it's broken and returns 'isearch-mouse-2' without ignoring > the current value of overriding-terminal-local-map, i.e. currently let-binding > 'overriding-terminal-local-map nil' has no effect for 'key-binding'. In 2018 the logic of searching a key binding was changed. Now it magically depends of the current mode instead of more explicit keymaps as before: Before 2018: (let ((isearch-mode t)) (key-binding [mouse-2] t)) => mouse-yank-primary After 2018: (let ((isearch-mode t)) (key-binding [mouse-2] t)) => isearch-mouse-2 Anyway here is the fix: