From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#23519: 25.0.93; pasting with the middle mouse button while searching doesn't work Date: Sun, 22 May 2016 13:49:40 -0700 Organization: UCLA Computer Science Department Message-ID: <57421B64.4070604@cs.ucla.edu> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010803040907000405090201" X-Trace: ger.gmane.org 1463950228 16532 80.91.229.3 (22 May 2016 20:50:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 May 2016 20:50:28 +0000 (UTC) Cc: Kaushal Modi , 23519-done@debbugs.gnu.org, Jan Synacek To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 22 22:50:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b4aKH-0003Fo-0P for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 May 2016 22:50:17 +0200 Original-Received: from localhost ([::1]:44625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4aKG-0001oC-20 for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 May 2016 16:50:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4aK7-0001ld-V3 for bug-gnu-emacs@gnu.org; Sun, 22 May 2016 16:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4aK2-00020Z-VZ for bug-gnu-emacs@gnu.org; Sun, 22 May 2016 16:50:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4aK2-00020U-SB for bug-gnu-emacs@gnu.org; Sun, 22 May 2016 16:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b4aK2-0000xK-JL for bug-gnu-emacs@gnu.org; Sun, 22 May 2016 16:50:02 -0400 In-Reply-To: Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 May 2016 20:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 23519 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 23519@debbugs.gnu.org, eggert@cs.ucla.edu, jsynacek@redhat.com Original-Received: via spool by 23519-done@debbugs.gnu.org id=D23519.14639501913643 (code D ref 23519); Sun, 22 May 2016 20:50:02 +0000 Original-Received: (at 23519-done) by debbugs.gnu.org; 22 May 2016 20:49:51 +0000 Original-Received: from localhost ([127.0.0.1]:33081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4aJq-0000wg-PT for submit@debbugs.gnu.org; Sun, 22 May 2016 16:49:51 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4aJo-0000wU-UE for 23519-done@debbugs.gnu.org; Sun, 22 May 2016 16:49:49 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 36B81161213; Sun, 22 May 2016 13:49:42 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id qcoRueFC5cGU; Sun, 22 May 2016 13:49:41 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4BFF3161217; Sun, 22 May 2016 13:49:41 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id n_nFXG8pWJPJ; Sun, 22 May 2016 13:49:41 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 24A25161213; Sun, 22 May 2016 13:49:41 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118546 Archived-At: This is a multi-part message in MIME format. --------------010803040907000405090201 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable > isearch currently doesn't have a binding for > xterm-paste. We should add one, just like we added one to global-map. Thanks, I did that by installing the attached patch into the emacs-25 bra= nch. --------------010803040907000405090201 Content-Type: text/x-diff; name="0001-Bring-back-xterm-pasting-with-middle-mouse.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Bring-back-xterm-pasting-with-middle-mouse.patch" =46rom 3ca5d39a25a6f56b5946c85fa9bdc722ee0c9546 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 22 May 2016 13:38:53 -0700 Subject: [PATCH] Bring back xterm pasting with middle mouse MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Jan Syn=C3=A1=C4=8Dek. Solution suggested by Stefan Monnier (Bug#23519). * lisp/isearch.el (isearch-mode-map): Add a binding for xterm-paste. (xterm--pasted-text): New decl. (isearch-xterm-paste): New function. * lisp/term/xterm.el (xterm--pasted-text): New function, taken from xterm-paste internals. (xterm-paste): Use it. --- lisp/isearch.el | 8 ++++++++ lisp/term/xterm.el | 39 ++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index e4de0b6..7360a0b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -510,6 +510,7 @@ isearch-mode-map ;; People expect to be able to paste with the mouse. (define-key map [mouse-2] #'isearch-mouse-2) (define-key map [down-mouse-2] nil) + (define-key map [xterm-paste] #'isearch-xterm-paste) =20 ;; Some bindings you may want to put in your isearch-mode-hook. ;; Suggest some alternates... @@ -2001,6 +2002,13 @@ isearch-mouse-2 (when (functionp binding) (call-interactively binding))))) =20 +(declare-function xterm--pasted-text "term/xterm" ()) + +(defun isearch-xterm-paste () + "Pull terminal paste into search string." + (interactive) + (isearch-yank-string (xterm--pasted-text))) + (defun isearch-yank-internal (jumpform) "Pull the text from point to the point reached by JUMPFORM. JUMPFORM is a lambda expression that takes no arguments and returns diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index e06423c..19eb37a 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -71,28 +71,29 @@ xterm-max-cut-length (defconst xterm-paste-ending-sequence "\e[201~" "Characters send by the terminal to end a bracketed paste.") =20 +(defun xterm--pasted-text () + "Handle the rest of a terminal paste operation. +Return the pasted text as a string." + (let ((end-marker-length (length xterm-paste-ending-sequence))) + (with-temp-buffer + (set-buffer-multibyte nil) + (while (not (search-backward xterm-paste-ending-sequence + (- (point) end-marker-length) t)) + (let ((event (read-event nil nil + ;; Use finite timeout to avoid glomming= the + ;; event onto this-command-keys. + most-positive-fixnum))) + (when (eql event ?\r) + (setf event ?\n)) + (insert event))) + (let ((last-coding-system-used)) + (decode-coding-region (point-min) (point) (keyboard-coding-system) + t))))) + (defun xterm-paste () "Handle the start of a terminal paste operation." (interactive) - (let* ((end-marker-length (length xterm-paste-ending-sequence)) - (pasted-text (with-temp-buffer - (set-buffer-multibyte nil) - (while (not (search-backward - xterm-paste-ending-sequence - (- (point) end-marker-length) t)) - (let ((event (read-event - nil nil - ;; Use finite timeout to avoid - ;; glomming the event onto - ;; this-command-keys. - most-positive-fixnum))) - (when (eql event ?\r) - (setf event ?\n)) - (insert event))) - (let ((last-coding-system-used)) - (decode-coding-region - (point-min) (point) - (keyboard-coding-system) t)))) + (let* ((pasted-text (xterm--pasted-text)) (interprogram-paste-function (lambda () pasted-text))) (yank))) =20 --=20 2.5.5 --------------010803040907000405090201--