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: Fri, 18 Nov 2011 10:02:52 -0800 Message-ID: References: <055102FB22B94F7E8A0B265429BF6E09@us.oracle.com><8D45DB2157F84E788061E93D188B14FE@us.oracle.com><80F2D45C3F624FCC918B30031333293C@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 1321639456 23093 80.91.229.12 (18 Nov 2011 18:04:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Nov 2011 18:04:16 +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 Fri Nov 18 19:04:12 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 1RRSnK-00085p-2G for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Nov 2011 19:04:10 +0100 Original-Received: from localhost ([::1]:59230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRSnJ-0002FE-J1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Nov 2011 13:04:09 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:58048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRSnG-0002Ew-4k for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2011 13:04:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRSnE-0002qj-SI for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2011 13:04:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRSnE-0002qf-Qe for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2011 13:04:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RRSoA-0001cT-0t for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2011 13:05: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: Fri, 18 Nov 2011 18:05: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.13216394446146 (code B ref 10022); Fri, 18 Nov 2011 18:05:01 +0000 Original-Received: (at 10022) by debbugs.gnu.org; 18 Nov 2011 18:04:04 +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 1RRSnD-0001b5-Md for submit@debbugs.gnu.org; Fri, 18 Nov 2011 13:04:03 -0500 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RRSnA-0001ad-BR for 10022@debbugs.gnu.org; Fri, 18 Nov 2011 13:04:01 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pAII308A008662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Nov 2011 18:03:00 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pAII2wB8024863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Nov 2011 18:02:59 GMT Original-Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pAII2rjc021145; Fri, 18 Nov 2011 12:02:53 -0600 Original-Received: from dradamslap1 (/10.159.62.141) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 Nov 2011 10:02:53 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: AcymF8NsHB6ErwKQTOO8q3GvkBShxAAAIv6w X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090205.4EC69DD5.0077,ss=1,re=0.000,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 18 Nov 2011 13:05:02 -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:54046 Archived-At: > > Dunno whether a binding of `ignore' makes better sense for > > vanilla Emacs here too (e.g., in case someone binds > > `down-mouse-2' globally). > > To the extent that isearch only binds mouse-2 in the minibuffer (yes, > it technically also binds it in the main buffer, but to a command that > just delegates to the normal binding), I don't think > down-mouse-2 should default to `ignore', except maybe in the minibuffer. What I meant was that a nil binding means pick up any currently effective (e.g. global) binding. If someone binds `down-mouse-2' globally (as I do) then that binding will be picked for Isearch also, and it might not be appropriate there. The question is whether you want Isearch to ignore a `down-mouse-2' action or to pick up any `down-mouse-2' action that might be defined (e.g. globally). IOW, should Isearch decide that it wants to impose the `down-mouse-2' behavior or should it let whatever behavior is defined elsewhere carry over to Isearch as well. Your call. > > That means that `isearch-mouse-2' barfs when it calls > > `isearch-yank-selection'. That function tries to yank the string > > returned by `x-get-selection', but that function returns nil, not a > > string. The PRIMARY selection is not set, at least in my context. > > This function apparently depend ons it being set. Seems like a > > bug, to me. > > AFAIK it's called "isearch-yank-x-selection", Yes, that's what I meant. > so it really doesn't seem like a bug for it to fail when there is > no GUI selection The bug would presumably be that `x-get-selection' returns nil here, but I would suppose that `isearch-yank-x-selection' might want to handle such an eventuality more gracefully. Anyway, there does not seem to be a problem for Emacs 24 - only older versions. > > (when (and transient-mark-mode (/= (region-beginning) (region-end))) > > (x-set-selection 'PRIMARY (buffer-substring-no-properties > > (region-beginning) (region-end))) > > (deactivate-mark) > > (isearch-yank-x-selection)) > > That presumes the region was meant as a "selection". I don't see why > isearch should make such an assumption. I gave a later version that does not use that - see the definition of `isearch-mouse-2' I sent. The part that corresponds to the ordinary, vanilla behavior is identical to the vanilla Emacs code. The part that uses the region as a selection is per user choice and is a separate feature: letting you click mouse-2 anywhere (not necessarily in the echo area), to insert the region text. > > Consider this only an FYI. I suspect there is a problem, > > and that the `isearch-mouse-2' code should not depend on the PRIMARY > > selection being set, but you decide. > > IIUC the intention is for it to perform a task similar to > `yank', so it needs to take the string from some kind of GUI > selection, or from the kill-ring, but taking it straight from the > region seems a bit much. Agreed. You misunderstood. Taking it from the region is for a separate, alternative behavior (user choice). > > 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. > > But that overrides an explicit request from the user (in her > .emacs) to not automatically consider the region as a selection. Again, this is per a user choice, via option `isearchp-mouse-2-flag'. The intent of such a choice is precisely to use the region as a selection here (and here only). Again, this is outside what vanilla Emacs does or should do. > So, while it might make sense when coupled with a new option such as > isearchp-mouse-2-flag, I don't see what Emacs-24.1 could do to help. Agreed. There is no change needed for vanilla Emacs 24. The only changes I have made are (a) for a non-nil option `isearchp-mouse-2-flag' (yank the non-empty region) and (b) for older Emacs versions (ensure the primary selection is set, so it can be yanked). This is why this is all only FYI (except perhaps for the `down-mouse-2' binding question - your call).