>> 0. Run in a terminal: emacs -Q -nw >> 1. C-s >> 2.1. either from the MATE Terminal context menu select "Paste" >> 2.2. or in xterm click the middle mouse button >> (both calls the same command) >> 3. Emacs hangs and typing 'C-g' produces the backtrace: > > Crystal ball says this is because of the xterm paste support. Can you > try after disabling that extension? I don't know how to disable it. Pasting works fine via ‘xterm-paste’ event and command with the same name. But hangs when evaluating ‘(xterm--pasted-text)’. Since the ‘xterm-paste’ command works without problems, I just copied its body to ‘isearch-xterm-paste’, and everything works fine with this patch: