From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#10022: 24.0.91; `isearch-mouse-2' relies on `x-get-selection' - NG for Windows etc. Date: Sun, 13 Nov 2011 12:22:51 -0800 Message-ID: <80F2D45C3F624FCC918B30031333293C@us.oracle.com> References: <055102FB22B94F7E8A0B265429BF6E09@us.oracle.com><8D45DB2157F84E788061E93D188B14FE@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1321215822 28937 80.91.229.12 (13 Nov 2011 20:23:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Nov 2011 20:23:42 +0000 (UTC) Cc: 10022@debbugs.gnu.org To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 13 21:23:38 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RPgaY-0006hZ-97 for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Nov 2011 21:23:38 +0100 Original-Received: from localhost ([::1]:44176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPgaX-0007lm-Iy for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Nov 2011 15:23:37 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPgaT-0007lf-VO for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2011 15:23:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPgaS-0002Ma-RS for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2011 15:23:33 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPgaS-0002MV-LJ for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2011 15:23:32 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RPgav-00010A-Vf for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2011 15:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2011 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10022 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10022-submit@debbugs.gnu.org id=B10022.13212158113812 (code B ref 10022); Sun, 13 Nov 2011 20:24:01 +0000 Original-Received: (at 10022) by debbugs.gnu.org; 13 Nov 2011 20:23:31 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RPgaR-0000zR-Jw for submit@debbugs.gnu.org; Sun, 13 Nov 2011 15:23:31 -0500 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RPgaP-0000zF-Ij for 10022@debbugs.gnu.org; Sun, 13 Nov 2011 15:23:30 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pADKMr3o010817 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 13 Nov 2011 20:22:54 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pADKMqKq008439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Nov 2011 20:22:52 GMT Original-Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pADKMk4F011193; Sun, 13 Nov 2011 14:22:46 -0600 Original-Received: from dradamslap1 (/10.159.62.159) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 13 Nov 2011 12:22:46 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcyhTF3J59G4MLTyQ1qCI1sHea29XwA84piQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4EC0271E.0019,ss=1,re=0.000,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 13 Nov 2011 15:24:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53876 Archived-At: > Steps to reproduce it, please. As I said in the OP: "No, I am not certain this is a bug - you decide. ... Consider this only an FYI." In case it helps, digging into this more shows that setting the X selection explicitly is necessary for the code to work also with older Emacs versions. That is not necessary for Emacs 24. FWIW, I use this, which gives users the option to not have to move the mouse to the echo area to yank the selection. Option `isearchp-mouse-2-flag' is t by default. (defun isearch-mouse-2 (click) "Handle `mouse-2' in Isearch mode. If `isearchp-mouse-2-flag' is non-nil, yank the X selection. If `isearchp-mouse-2-flag' is nil, yank it only if the `mouse-2' click is in the echo area. Otherwise, invoke whatever `mouse-2' is bound to outside of Isearch." (interactive "e") (if (not isearchp-mouse-2-flag) (let ((win (posn-window (event-start click))) (overriding-terminal-local-map nil) (binding (key-binding (this-command-keys-vector) t))) (if (and (window-minibuffer-p win) (not (minibuffer-window-active-p win))) ; In echo area (isearchp-set-sel-and-yank) (when (functionp binding) (call-interactively binding)))) (when (/= (region-beginning) (region-end)) (isearchp-set-sel-and-yank)))) (defun isearchp-set-sel-and-yank () "Set X selection and yank it into echo area." (x-set-selection 'PRIMARY (buffer-substring-no-properties (region-beginning) (region-end))) (deactivate-mark) (isearch-yank-x-selection)) If it were not for needing the code to work with older Emacs versions, all that would be needed would be this: (defun isearch-mouse-2 (click) "..." (interactive "e") (if (not isearchp-mouse-2-flag) (let ((win (posn-window (event-start click))) (overriding-terminal-local-map nil) (binding (key-binding (this-command-keys-vector) t))) (if (and (window-minibuffer-p win) (not (minibuffer-window-active-p win))) ; In echo area (isearch-yank-x-selection) (when (functionp binding) (call-interactively binding)))) (when (/= (region-beginning) (region-end)) (let ((select-active-regions t)) (deactivate-mark) (isearch-yank-x-selection))))) The binding of `select-active-region' is needed, however. Without that (and with a customized setting of nil), `get-x-selection' returns nil - the problem I mentioned earlier. HTH.