From unknown Fri Aug 15 12:45:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8996 <8996@debbugs.gnu.org> To: bug#8996 <8996@debbugs.gnu.org> Subject: Status: Set PRIMARY from last selection, not last selected window Reply-To: bug#8996 <8996@debbugs.gnu.org> Date: Fri, 15 Aug 2025 19:45:51 +0000 retitle 8996 Set PRIMARY from last selection, not last selected window reassign 8996 emacs submitter 8996 Stefan Monnier severity 8996 important thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 04 13:20:00 2011 Received: (at submit) by debbugs.gnu.org; 4 Jul 2011 17:20:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdmoR-0007gf-Uo for submit@debbugs.gnu.org; Mon, 04 Jul 2011 13:20:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdmoP-0007gT-2s for submit@debbugs.gnu.org; Mon, 04 Jul 2011 13:19:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdmoH-0001un-RK for submit@debbugs.gnu.org; Mon, 04 Jul 2011 13:19:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:41031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdmoH-0001uc-HG for submit@debbugs.gnu.org; Mon, 04 Jul 2011 13:19:49 -0400 Received: from eggs.gnu.org ([140.186.70.92]:42635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdmoF-00078y-Bt for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 13:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdmoD-0001u3-7S for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 13:19:47 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:28799 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdmoC-0001tq-Po for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 13:19:45 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAKH1EU5FxIxr/2dsb2JhbABQA5kHAY5zeKsCnnmDQYJ1BJ5chCw X-IronPort-AV: E=Sophos;i="4.65,473,1304308800"; d="scan'208";a="120396827" Received: from 69-196-140-107.dsl.teksavvy.com (HELO pastel.home) ([69.196.140.107]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 04 Jul 2011 13:19:43 -0400 Received: by pastel.home (Postfix, from userid 20848) id D8A5459173; Mon, 4 Jul 2011 13:19:42 -0400 (EDT) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: Set PRIMARY from last selection, not last selected window Date: Mon, 04 Jul 2011 13:19:42 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) With focus-follows-mouse (and/or mouse-autoselect-window), I often get surprising results in my PRIMARY. E.g.: 1- in window/frame 1 I select a piece of text "test" with the mouse. 2- I move the mouse to an xterm 3- I middle click, and lo and behold rather than "test" I see some unrelated selection inserted. What happened is that at step 2 I happened to move the mouse over some other Emacs window which happens to also have an active region, and my focus-follows-mouse window manager (and/or mouse-autoselect-window setting) caused Emacs to temporarily select this other region, changing the PRIMARY selection from the "test" I just selected to something completely different. For the last few months I attributed this "erratic middle-click in xterm" to the fact that I'm not used to have to distinguish the PRIMARY from the CLIPBOARD, and only yesterday did I figure out where it's coming from. Stefan In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4) of 2011-06-25 on pastel Windowing system distributor `The X.Org Foundation', version 11.0.11002000 configured using `configure 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O0 -I/usr/include/GNUstep'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_CH.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: InactiveMinibuffer Minor modes in effect: shell-dirtrack-mode: t diff-auto-refine-mode: t electric-pair-mode: t electric-indent-mode: t url-handler-mode: t global-reveal-mode: t reveal-mode: t auto-insert-mode: t savehist-mode: t minibuffer-electric-default-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x v = C-x C-s C-x C-w C-g C-g C-x v = C-x h M-w C-s 1 7 1 0 C-s C-a M-d a l t C-d C-e C-d C-a C-x C-s M-x r e p o - e m - b u Recent messages: Warning: special-display-p is obsolete! Warning: same-window-p is obsolete! Finding changes in /home/monnier/src/emacs/work/src/textprop.c...done Mark set [2 times] Warning: interactive-p is obsolete! Mark set [5 times] Mark saved where search started Saving file /home/monnier/src/emacs/work/src/textprop.c... Wrote /home/monnier/src/emacs/work/src/textprop.c Warning: interactive-p is obsolete! Load-path shadows: /usr/share/emacs23/site-lisp/bbdb/bbdb hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb /usr/share/emacs23/site-lisp/bbdb/bbdb-mhe hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-mhe /usr/share/emacs23/site-lisp/bbdb/bbdb-gnus hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gnus /usr/share/emacs23/site-lisp/bbdb/bbdb-migrate hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-migrate /usr/share/emacs23/site-lisp/bbdb/bbdb-sc hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-sc /usr/share/emacs23/site-lisp/bbdb/bbdb-snarf hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-snarf /usr/share/emacs23/site-lisp/bbdb/bbdb-w3 hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-w3 /usr/share/emacs23/site-lisp/bbdb/bbdb-gui hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gui /usr/share/emacs23/site-lisp/bbdb/bbdb-print hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-print /usr/share/emacs23/site-lisp/bbdb/bbdb-rmail hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-rmail /usr/share/emacs23/site-lisp/bbdb/bbdb-vm hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-vm /usr/share/emacs23/site-lisp/bbdb/bbdb-ftp hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-ftp /usr/share/emacs23/site-lisp/bbdb/bbdb-merge hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-merge /usr/share/emacs23/site-lisp/bbdb/bbdb-whois hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-whois /usr/share/emacs23/site-lisp/bbdb/bbdb-com hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-com /usr/share/emacs23/site-lisp/bbdb/bbdb-hooks hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-hooks Features: (mail-extr message sendmail format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils mailheader emacsbug sort network-stream starttls tls mpc gud doc-view jka-compr image-mode dired completion vc-annotate shell pcomplete grep compile hideif cpp cmacexp cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs dabbrev cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs cal-french diary-lib diary-loaddefs mule-util cal-move cal-menu calendar cal-loaddefs smerge-mode octave-mod skeleton derived smie cl-specs log-view log-edit pcvs-util vc-sccs vc-svn vc-cvs vc-rcs vc-dir add-log whitespace diff-mode vc ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff vc-dispatcher executable copyright multi-isearch xscheme trace testcover scheme unsafep re-builder shadow inf-lisp ielm pp comint ring gmm-utils ert find-func ewoc debug elp edebug cust-print cus-edit cus-start cus-load wid-edit vc-bzr filecache server noutline outline easy-mmode flyspell ispell eldoc checkdoc regexp-opt thingatpt help-mode easymenu view prog-mode electric url-handlers url-parse auth-source warnings eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util time-date password-cache url-vars mm-util mail-prsvr reveal autoinsert uniquify advice help-fns advice-preload savehist minibuf-eldef disp-table cl cl-loaddefs proof-site proof-autoloads pg-vars bbdb-autoloads agda2 tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page newcomment menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 04 15:12:03 2011 Received: (at 8996) by debbugs.gnu.org; 4 Jul 2011 19:12:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdoYt-0004K6-8W for submit@debbugs.gnu.org; Mon, 04 Jul 2011 15:12:03 -0400 Received: from harpegolden.net ([65.99.215.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdoYr-0004Je-Dr for 8996@debbugs.gnu.org; Mon, 04 Jul 2011 15:12:02 -0400 Received: from [87.198.47.56] (87-198-47-56.ptr.magnet.ie [87.198.47.56]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 2C62D683D8; Mon, 4 Jul 2011 20:11:55 +0100 (IST) Message-ID: <4E121079.6020103@harpegolden.net> Date: Mon, 04 Jul 2011 20:11:53 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 04/07/11 18:19, Stefan Monnier wrote: > With focus-follows-mouse (and/or mouse-autoselect-window), I often get > surprising results in my PRIMARY. E.g.: > > 1- in window/frame 1 I select a piece of text "test" with the mouse. > 2- I move the mouse to an xterm > 3- I middle click, and lo and behold rather than "test" I see some > unrelated selection inserted. > > What happened is that at step 2 I happened to move the mouse over some > other Emacs window which happens to also have an active region, and my > focus-follows-mouse window manager (and/or mouse-autoselect-window > setting) caused Emacs to temporarily select this other region, changing > the PRIMARY selection from the "test" I just selected to something > completely different. > Erk. Sorry, yes, this AFAIK sounds like a known (to some people...) problem that is apparently still present in at least some circumstances. I actually meant to check if it was still occurring after the customization vs. binding thing was decided and if so file it as a bug. I had previously mentioned the subtlety under #6774 (at least) [1], and ISTR Chong Yidong also being aware of it, though I'm having some trouble finding the relevant email, so hopefully I'm not unjustly saying that. A fair bit of the implementation has AFAIK changed since #6774, but I guess the issue was carried forward. [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6774#32 """ Try it between two kate windows both with selected text, say - note how the selection doesn't change depending on which window you're currently in, it depends on the last text the user actively selected. """ From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 04 16:27:38 2011 Received: (at 8996) by debbugs.gnu.org; 4 Jul 2011 20:27:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qdpk2-0006rV-EW for submit@debbugs.gnu.org; Mon, 04 Jul 2011 16:27:38 -0400 Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qdpk1-0006rI-3u for 8996@debbugs.gnu.org; Mon, 04 Jul 2011 16:27:37 -0400 Received: from furball (dhcp128036226224.central.yale.edu [128.36.226.224]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p64KRVAd006150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 4 Jul 2011 16:27:31 -0400 From: Chong Yidong To: David De La Harpe Golden Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> Date: Mon, 04 Jul 2011 16:27:31 -0400 In-Reply-To: <4E121079.6020103@harpegolden.net> (David De La Harpe Golden's message of "Mon, 04 Jul 2011 20:11:53 +0100") Message-ID: <8739illrkc.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8996 Cc: Stefan Monnier , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) David De La Harpe Golden writes: > Erk. Sorry, yes, this AFAIK sounds like a known (to some people...) > problem that is apparently still present in at least some > circumstances. I actually meant to check if it was still occurring > after the customization vs. binding thing was decided and if so file > it as a bug. > > I had previously mentioned the subtlety under #6774 (at least) [1], > and ISTR Chong Yidong also being aware of it, though I'm having some > trouble finding the relevant email, so hopefully I'm not unjustly > saying that. I can't reproduce this bug with Metacity with focus-follows-mouse on. I'm surprised this issue has reappeared; the whole point of the current active selection implementation is that Emacs grabs the primary selection only after executing a command (in the command loop). Simply switching to an Emacs frame should not trigger it---could it be that your Emacs is customized to do something funky with the command loop? From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 04 23:27:03 2011 Received: (at 8996) by debbugs.gnu.org; 5 Jul 2011 03:27:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdwHv-0000ww-54 for submit@debbugs.gnu.org; Mon, 04 Jul 2011 23:27:03 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdwHt-0000wS-N4 for 8996@debbugs.gnu.org; Mon, 04 Jul 2011 23:27:02 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAC2DEk5FxIxr/2dsb2JhbABTp3x4iHrDEIY2BJ5chCw X-IronPort-AV: E=Sophos;i="4.65,476,1304308800"; d="scan'208";a="120497633" Received: from 69-196-140-107.dsl.teksavvy.com (HELO ceviche.home) ([69.196.140.107]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 04 Jul 2011 23:26:55 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 6747B66112; Mon, 4 Jul 2011 23:26:55 -0400 (EDT) From: Stefan Monnier To: Chong Yidong Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window Message-ID: References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> Date: Mon, 04 Jul 2011 23:26:55 -0400 In-Reply-To: <8739illrkc.fsf@stupidchicken.com> (Chong Yidong's message of "Mon, 04 Jul 2011 16:27:31 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8996 Cc: 8996@debbugs.gnu.org, David De La Harpe Golden X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) >> Erk. Sorry, yes, this AFAIK sounds like a known (to some people...) >> problem that is apparently still present in at least some >> circumstances. I actually meant to check if it was still occurring >> after the customization vs. binding thing was decided and if so file >> it as a bug. >> >> I had previously mentioned the subtlety under #6774 (at least) [1], >> and ISTR Chong Yidong also being aware of it, though I'm having some >> trouble finding the relevant email, so hopefully I'm not unjustly >> saying that. > I can't reproduce this bug with Metacity with focus-follows-mouse on. > I'm surprised this issue has reappeared; the whole point of the current > active selection implementation is that Emacs grabs the primary > selection only after executing a command (in the command loop). Simply > switching to an Emacs frame should not trigger it---could it be that > your Emacs is customized to do something funky with the command loop? Here's my recipe with no funky anything (just plain old trunk): % trunk/src/emacs -Q C-x 2 M-: (setq mouse-autoselect-window t) RET Select a word with a double-mouse-1 click on a word in one of the two windows. Move the mouse over the other window and then outside Emacs frame to an xterm. Hit mouse-2 in the xterm. In my case, the mouse-2 does not paste the selected word but the other part of the buffer that happened to be the selected region in the other window. The window manager is ctwm rather than Metacity, in case it matters. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 05 06:11:59 2011 Received: (at 8996) by debbugs.gnu.org; 5 Jul 2011 10:11:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qe2bn-0001MS-Hl for submit@debbugs.gnu.org; Tue, 05 Jul 2011 06:11:59 -0400 Received: from harpegolden.net ([65.99.215.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qe2bi-0001Lw-Nk for 8996@debbugs.gnu.org; Tue, 05 Jul 2011 06:11:55 -0400 Received: from [87.198.47.58] (87-198-47-58.ptr.magnet.ie [87.198.47.58]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 4150E683D8; Tue, 5 Jul 2011 11:11:48 +0100 (IST) Message-ID: <4E12E362.9090709@harpegolden.net> Date: Tue, 05 Jul 2011 11:11:46 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 05/07/11 04:26, Stefan Monnier wrote: > The window manager is ctwm rather than Metacity, in case it matters. > It may be relevant - focus-follows-mouse may be implemented somewhat gesturally in some window managers, i.e. you may have to dwell a fraction of a second in a window before focus actually shifts, even if you don't have to click to focus, so that "just passing through" windows get skipped. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 08 01:54:22 2011 Received: (at 8996) by debbugs.gnu.org; 8 Jul 2011 05:54:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qf417-0001OD-Rm for submit@debbugs.gnu.org; Fri, 08 Jul 2011 01:54:22 -0400 Received: from harpegolden.net ([65.99.215.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qf416-0001Nz-2G for 8996@debbugs.gnu.org; Fri, 08 Jul 2011 01:54:20 -0400 Received: from [87.198.47.58] (87-198-47-58.ptr.magnet.ie [87.198.47.58]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 615F2683D8; Fri, 8 Jul 2011 06:54:13 +0100 (IST) Message-ID: <4E169B83.4050706@harpegolden.net> Date: Fri, 08 Jul 2011 06:54:11 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 05/07/11 04:26, Stefan Monnier wrote: > The window manager is ctwm rather than Metacity, in case it matters. > I can replicate this (not just with ctwm) The issue I was thinking of is still present too, and is likely closely related / really the same thing. emacs -Q C-x 2 point is at end of scratch buffer in the window you're in. Now select word "create" with M-SPC and arrow keys, mark at start of word, point at end of word. C-x o create to the end of buffer is highlighted in current window.* select word "visit" in window you're now in with M-SPC and arrow keys, mark at start of word, point at end of word. C-x o Note " a file, " is highlighted.* hit mouse-2 on the end of the word "enter" in current window. ++ " a file, " is inserted, whereas user expectation is probably "visit", as the most recently actively selected by the user. If we made it insert "visit", and (unlikely) the user did actually want " a file, ", they could hit C-x C-x [C-x C-x], say, to make that region the last actively selected by the user. * Notionally pretty separate issue, best considered a separate bug or wishlist item: Point position is saved/restored on a per-window basis by select-window, but the mark position (and active status) is not. IMO both point and mark (and active status) could do with being saved per-window and restored on window switches. That would be a noticeable behavioural change if done by default (could be optional though), and is presumably not a runner even as an option right at this very moment (feature freeze). And of course, an ability to set the mark in one window open on a large buffer and the point in another window open onto a different place in the same large buffer is sortof a feature (though it's also possible to imagine both switch-window and, uh, switch-window-keeping-current-mark-position being available on different bindings). From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 10 22:57:26 2011 Received: (at 8996) by debbugs.gnu.org; 11 Jul 2011 02:57:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qg6gX-0006z5-NO for submit@debbugs.gnu.org; Sun, 10 Jul 2011 22:57:25 -0400 Received: from harpegolden.net ([65.99.215.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qg6gT-0006yr-4N for 8996@debbugs.gnu.org; Sun, 10 Jul 2011 22:57:24 -0400 Received: from [87.198.47.209] (87-198-47-209.ptr.magnet.ie [87.198.47.209]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id BAE836841D; Mon, 11 Jul 2011 03:57:14 +0100 (IST) Message-ID: <4E1A6689.1040203@harpegolden.net> Date: Mon, 11 Jul 2011 03:57:13 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> In-Reply-To: <4E169B83.4050706@harpegolden.net> Content-Type: multipart/mixed; boundary="------------030001020800000200040905" X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) This is a multi-part message in MIME format. --------------030001020800000200040905 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/07/11 06:54, David De La Harpe Golden wrote: > On 05/07/11 04:26, Stefan Monnier wrote: > > >> The window manager is ctwm rather than Metacity, in case it matters. >> > > I can replicate this (not just with ctwm) > > The issue I was thinking of is still present too, and is likely > closely related / really the same thing. Hmm. bug #6872 was addressed by trunk r101176, which suppresses the primary update on handle_switch_frame, but, well, that only covers that immediate frame switch case. Kinda need to address switching between individual windows too (or actually instead since handle_switch_frame will always wind up calling select_window itself, I think). However, select-window itself is not a command afaiui, and enumerating all potential window-switching commands is probably not viable. I can't say I like the attached solution (modelled on the deactivate-mark variable) very much, though nor did I have any especially better ideas. --------------030001020800000200040905 Content-Type: text/x-patch; name="select-active-regions_noupdate_on_select_window_r1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="select-active-regions_noupdate_on_select_window_r1.diff" === modified file 'lisp/simple.el' --- lisp/simple.el 2011-07-06 19:44:09 +0000 +++ lisp/simple.el 2011-07-11 02:44:14 +0000 @@ -3701,6 +3701,7 @@ (when (and (if (eq select-active-regions 'only) (eq (car-safe transient-mark-mode) 'only) select-active-regions) + (not skip-active-region-selection) (region-active-p) (display-selections-p)) ;; The var `saved-region-selection', if non-nil, is the text in === modified file 'src/keyboard.c' --- src/keyboard.c 2011-07-02 23:40:04 +0000 +++ src/keyboard.c 2011-07-11 02:43:15 +0000 @@ -1337,6 +1337,7 @@ KVAR (current_kboard, Vprefix_arg) = Qnil; KVAR (current_kboard, Vlast_prefix_arg) = Qnil; Vdeactivate_mark = Qnil; + Vskip_active_region_selection = Qnil; waiting_for_input = 0; cancel_echoing (); @@ -1388,6 +1389,7 @@ display_malloc_warning (); Vdeactivate_mark = Qnil; + Vskip_active_region_selection = Qnil; /* If minibuffer on and echo area in use, wait a short time and redraw minibuffer. */ @@ -1512,6 +1514,7 @@ /* Process filters and timers may have messed with deactivate-mark. reset it before we execute the command. */ Vdeactivate_mark = Qnil; + Vskip_active_region_selection = Qnil; /* Remap command through active keymaps */ Vthis_original_command = cmd; @@ -1648,7 +1651,7 @@ ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) && !NILP (Vtransient_mark_mode))) - && !EQ (Vthis_command, Qhandle_switch_frame)) + && NILP (Vskip_active_region_selection)) { EMACS_INT beg = XINT (Fmarker_position (BVAR (current_buffer, mark))); @@ -12212,6 +12215,16 @@ `deactivate-mark' call uses this to set the window selection. */); Vsaved_region_selection = Qnil; + DEFVAR_LISP ("skip-active-region-selection", Vskip_active_region_selection, + doc: /* If an editing command sets this to t, don't update the primary selection. +The command loop sets this to nil before each command, +and tests the value when the command returns. Certain atypical commands +(e.g. window and frame switching) may change the current active region, +yet it is incorrect to update the system selection from that active +region at that time, as would normally be done if select-active-regions +is non-nil */); + Vskip_active_region_selection = Qnil; + DEFVAR_LISP ("debug-on-event", Vdebug_on_event, doc: /* Enter debugger on this event. When Emacs === modified file 'src/window.c' --- src/window.c 2011-07-02 10:36:48 +0000 +++ src/window.c 2011-07-11 02:23:31 +0000 @@ -339,6 +339,9 @@ if (EQ (window, selected_window) && !inhibit_point_swap) return window; + /* frame/window switches are not grounds to update the primary selection */ + Vskip_active_region_selection = Qt; + sf = SELECTED_FRAME (); if (XFRAME (WINDOW_FRAME (w)) != sf) { --------------030001020800000200040905-- From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 13 09:53:01 2012 Received: (at 8996) by debbugs.gnu.org; 13 Mar 2012 13:53:01 +0000 Received: from localhost ([127.0.0.1]:48567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7S9s-0004xl-Ko for submit@debbugs.gnu.org; Tue, 13 Mar 2012 09:53:01 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:54423) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7S9q-0004xc-St; Tue, 13 Mar 2012 09:52:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9soXdS/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="167793319" Received: from 108-161-119-82.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([108.161.119.82]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Mar 2012 09:23:02 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D024FAE08C; Tue, 13 Mar 2012 09:23:01 -0400 (EDT) From: Stefan Monnier To: David De La Harpe Golden Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window Message-ID: References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> Date: Tue, 13 Mar 2012 09:23:01 -0400 In-Reply-To: <4E1A6689.1040203@harpegolden.net> (David De La Harpe Golden's message of "Mon, 11 Jul 2011 03:57:13 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) severity 8996 important thanks > Hmm. bug #6872 was addressed by trunk r101176, which suppresses the primary > update on handle_switch_frame, but, well, that only covers that immediate > frame switch case. Kinda need to address switching between individual > windows too (or actually instead since handle_switch_frame will always wind > up calling select_window itself, I think). However, select-window itself is > not a command afaiui, and enumerating all potential window-switching > commands is probably not viable. I can't say I like the attached solution > (modelled on the deactivate-mark variable) very much, though nor did I have > any especially better ideas. I think this approach isn't as terrible as it sounds (tho I don't much like the name you chose, sorry). We'd want to let-bind that new var in things like save-selected-window, with-selected-window, ... which is kind of ugly. Maybe a better approach is to record the selected window before running a command, and only do the select-active-regions dance if the command did not change the selected window. Along the same lines, another approach that doesn't pay attention to windows is to record the current buffer and the region's status before running the command, and only do the select-active-regions is the buffer is the same and the region's status has changed. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 18 15:48:57 2012 Received: (at 8996) by debbugs.gnu.org; 18 Mar 2012 19:48:57 +0000 Received: from localhost ([127.0.0.1]:55972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S9M65-0005wT-7W for submit@debbugs.gnu.org; Sun, 18 Mar 2012 15:48:57 -0400 Received: from harpegolden.net ([65.99.215.13]:59360) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S9M61-0005wK-Ix for 8996@debbugs.gnu.org; Sun, 18 Mar 2012 15:48:55 -0400 Received: from [87.198.47.59] (87-198-47-59.ptr.magnet.ie [87.198.47.59]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 26583683CF; Sun, 18 Mar 2012 19:18:26 +0000 (GMT) Message-ID: <4F663500.7070200@harpegolden.net> Date: Sun, 18 Mar 2012 19:18:24 +0000 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: Chong Yidong , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 13/03/12 13:23, Stefan Monnier wrote: > I think this approach isn't as terrible as it sounds (tho I don't much like > the name you chose, sorry). We'd want to let-bind that new var in > things like save-selected-window, with-selected-window, ... which is > kind of ugly. I dunno, maybe if 'tis getting time ordering right we're worried about, we should stop trying to make an ordering emergent from global state and impose one, probably more robust - save an actual timestamp or sequence number with saved positions (and restore it on position restore), and if the current selection postdates, it just shouldn't be reset (x11 selections are already timestamped anyway IIRC, dunno about other platforms). > Maybe a better approach is to record the selected window before running > a command, and only do the select-active-regions dance if the command did > not change the selected window. Not convinced myself that covers commands that actually legitimately change the selected window and also set a new region, like maybe a mouse gesture. though turns out I'm now rusty in the area and may not have thought it through fully. > and only do the select-active-regions is the > buffer is the same and the region's status has changed. I don't think that one can work - two different windows can routinely be open on the same buffer? From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 24 07:42:41 2012 Received: (at 8996) by debbugs.gnu.org; 24 Mar 2012 11:42:41 +0000 Received: from localhost ([127.0.0.1]:36338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBPMl-0003Xw-Sr for submit@debbugs.gnu.org; Sat, 24 Mar 2012 07:42:40 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:44315) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBPMA-0003XD-MQ for 8996@debbugs.gnu.org; Sat, 24 Mar 2012 07:42:36 -0400 Received: from bb121-6-68-206.singnet.com.sg ([121.6.68.206]:34235 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SBOs9-0003ao-RO; Sat, 24 Mar 2012 07:11:03 -0400 From: Chong Yidong To: Stefan Monnier Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> Date: Sat, 24 Mar 2012 19:10:53 +0800 In-Reply-To: (Stefan Monnier's message of "Tue, 13 Mar 2012 09:23:01 -0400") Message-ID: <87pqc2b6f6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: 8996@debbugs.gnu.org, David De La Harpe Golden X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Stefan Monnier writes: >> Hmm. bug #6872 was addressed by trunk r101176, which suppresses the >> primary update on handle_switch_frame, but, well, that only covers >> that immediate frame switch case. Kinda need to address switching >> between individual windows too (or actually instead since >> handle_switch_frame will always wind up calling select_window itself, >> I think). However, select-window itself is not a command afaiui, and >> enumerating all potential window-switching commands is probably not >> viable. I can't say I like the attached solution (modelled on the >> deactivate-mark variable) very much, though nor did I have any >> especially better ideas. > > I think this approach isn't as terrible as it sounds (tho I don't much > like the name you chose, sorry). We'd want to let-bind that new var > in things like save-selected-window, with-selected-window, ... which > is kind of ugly. > > Maybe a better approach is to record the selected window before > running a command, and only do the select-active-regions dance if the > command did not change the selected window. Why not just extend the Bug#6872 approach to handle-select-window too? === modified file 'src/keyboard.c' *** src/keyboard.c 2012-02-24 08:34:09 +0000 --- src/keyboard.c 2012-03-24 11:09:56 +0000 *************** *** 241,246 **** --- 241,247 ---- Time last_event_timestamp; static Lisp_Object Qx_set_selection, Qhandle_switch_frame; + static Lisp_Object Qhandle_select_window; Lisp_Object QPRIMARY; static Lisp_Object Qself_insert_command; *************** *** 1647,1653 **** ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) && !NILP (Vtransient_mark_mode))) ! && !EQ (Vthis_command, Qhandle_switch_frame)) { EMACS_INT beg = XINT (Fmarker_position (BVAR (current_buffer, mark))); --- 1648,1655 ---- ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) : (!NILP (Vselect_active_regions) && !NILP (Vtransient_mark_mode))) ! && !EQ (Vthis_command, Qhandle_switch_frame) ! && !EQ (Vthis_command, Qhandle_select_window)) { EMACS_INT beg = XINT (Fmarker_position (BVAR (current_buffer, mark))); *************** *** 11649,11654 **** --- 11651,11657 ---- DEFSYM (Qx_set_selection, "x-set-selection"); DEFSYM (QPRIMARY, "PRIMARY"); DEFSYM (Qhandle_switch_frame, "handle-switch-frame"); + DEFSYM (Qhandle_select_window, "handle-select-window"); DEFSYM (Qinput_method_function, "input-method-function"); DEFSYM (Qinput_method_exit_on_first_char, "input-method-exit-on-first-char"); From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 00:04:06 2012 Received: (at 8996) by debbugs.gnu.org; 25 Mar 2012 04:04:06 +0000 Received: from localhost ([127.0.0.1]:37339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBegX-0002pF-4t for submit@debbugs.gnu.org; Sun, 25 Mar 2012 00:04:05 -0400 Received: from harpegolden.net ([65.99.215.13]:38574) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBegH-0002ob-3v for 8996@debbugs.gnu.org; Sun, 25 Mar 2012 00:04:03 -0400 Received: from [87.198.47.36] (87-198-47-36.ptr.magnet.ie [87.198.47.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 22E716841F; Sun, 25 Mar 2012 04:32:46 +0100 (IST) Message-ID: <4F6E91DB.30200@harpegolden.net> Date: Sun, 25 Mar 2012 04:32:43 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: Chong Yidong Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> In-Reply-To: <87pqc2b6f6.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: Stefan Monnier , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 24/03/12 11:10, Chong Yidong wrote: > Why not just extend the Bug#6872 approach to handle-select-window too? > Well, that only catches cases that happen owing to things that trigger the event that handle-select-window is bound to. But that event isn't fired when you C-x o - other-window just straight calls the select-window function. So, with your patch applied, it probably fixes the visible issue in Stefan's focus-follows-mouse case, but my keyboard recipe previously given still yields the "wrong"* selection. So, you say, "then why not just add other-window too with the same approach?" Well, maybe, but then how many more need to be added after that? That's what I was getting at when I previously remarked "enumerating all potential window-switching commands is probably not viable.". Or maybe it is, though I guess in principle users could also define arbitrary new commands that called select-window (not sure many would. Maybe there could be an extensible select-inhibit-commands-list, and users who do such things could be told to push their command onto it...) * there is probably an approach that can allow both behaviours as a switchable user customization, in case you think the selection yielded via the keyboard recipe is "right"... From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 00:13:50 2012 Received: (at 8996) by debbugs.gnu.org; 25 Mar 2012 04:13:50 +0000 Received: from localhost ([127.0.0.1]:37343 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBepx-00032Z-OE for submit@debbugs.gnu.org; Sun, 25 Mar 2012 00:13:50 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:54903) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBepO-00031v-W7 for 8996@debbugs.gnu.org; Sun, 25 Mar 2012 00:13:49 -0400 Received: from bb121-6-68-206.singnet.com.sg ([121.6.68.206]:36383 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SBeLL-0006Os-Bv; Sat, 24 Mar 2012 23:42:12 -0400 From: Chong Yidong To: David De La Harpe Golden Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> <4F6E91DB.30200@harpegolden.net> Date: Sun, 25 Mar 2012 11:42:03 +0800 In-Reply-To: <4F6E91DB.30200@harpegolden.net> (David De La Harpe Golden's message of "Sun, 25 Mar 2012 04:32:43 +0100") Message-ID: <87iphtwdmc.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: Stefan Monnier , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) David De La Harpe Golden writes: > Well, that only catches cases that happen owing to things that trigger > the event that handle-select-window is bound to. > > But that event isn't fired when you C-x o - other-window just straight > calls the select-window function. So, with your patch applied, it > probably fixes the visible issue in Stefan's focus-follows-mouse case, > but my keyboard recipe previously given still yields the "wrong"* > selection. OTOH, keyboard commands stealing the selection seems a little less problematic, because the user is specifically doing an Emacs command rather than just moving the mouse. I'm not sure it's wrong for C-x o to get the selection if the window switched to has an active region. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 10:13:38 2012 Received: (at 8996) by debbugs.gnu.org; 25 Mar 2012 14:13:38 +0000 Received: from localhost ([127.0.0.1]:38349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBoCQ-00029O-0o for submit@debbugs.gnu.org; Sun, 25 Mar 2012 10:13:38 -0400 Received: from harpegolden.net ([65.99.215.13]:44707) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBoC9-000292-HH for 8996@debbugs.gnu.org; Sun, 25 Mar 2012 10:13:36 -0400 Received: from [87.198.47.36] (87-198-47-36.ptr.magnet.ie [87.198.47.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id 18A81683CF; Sun, 25 Mar 2012 14:42:15 +0100 (IST) Message-ID: <4F6F20B6.6090904@harpegolden.net> Date: Sun, 25 Mar 2012 14:42:14 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: Chong Yidong Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> <4F6E91DB.30200@harpegolden.net> <87iphtwdmc.fsf@gnu.org> In-Reply-To: <87iphtwdmc.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: Stefan Monnier , 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 25/03/12 04:42, Chong Yidong wrote: > David De La Harpe Golden writes: > >> Well, that only catches cases that happen owing to things that trigger >> the event that handle-select-window is bound to. >> >> But that event isn't fired when you C-x o - other-window just straight >> calls the select-window function. So, with your patch applied, it >> probably fixes the visible issue in Stefan's focus-follows-mouse case, >> but my keyboard recipe previously given still yields the "wrong"* >> selection. > > OTOH, keyboard commands stealing the selection seems a little less > problematic, because the user is specifically doing an Emacs command > rather than just moving the mouse. I'm not sure it's wrong for C-x o to > get the selection if the window switched to has an active region. Hmm, well, subjectively it did feel wrong to me, it is after all the context I spotted the issue in. But I'm now presumably also influenced by months of using my locally munged emacs. In terms of current practice of one of our "competitors" (loosely) that has fairly similar functionality, kde kate, it does _not_ appear to reset x11 primary to the older but still visibly highlighted region when you just switch between windows, even with the keyboard (of course it doesn't use emacs terminology for the entities in question, but functionally similar), it sticks to the temporal order: launch kate, enter a new session enter "The quick brown fox jumps over the lazy dog." hit Ctrl-Shift-T (split window) select (shift-arrow keys) "fox" in window #1 hit F8 (switch window) select (shift-arrow keys) "dog" in window #2 hit F8 (switch window) -> current window #1 again, and has "fox" region still visibly highlighted (and it is again current in terms of intra-kate ops like overtyping it) hit mouse-2 -> "dog" is inserted from primary. In gvim, given modality there are probably too many differences for the comparison to be fair, anyway it doesn't reset primary to the older (and unlike emacs/kate, not visible anyway) region when you switch windows. Visible region highlighting apparently disappears once you exit visual mode, so the question of visual vs. temporal correspondence that arises in emacs/kate is irrelevant, temporal is the natural option. Visual mode seems to be exited when you switch windows to a window onto a different buffer, it's only maintained if both windows are onto the same buffer and in which case they apparently have the same visual region, so the same-buffer/different-window/different-visible-region case of emacs or kate probably can't arise (not a vim expert, mind). From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 10:52:23 2012 Received: (at 8996) by debbugs.gnu.org; 25 Mar 2012 14:52:23 +0000 Received: from localhost ([127.0.0.1]:38371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBons-0003rG-Hs for submit@debbugs.gnu.org; Sun, 25 Mar 2012 10:52:22 -0400 Received: from harpegolden.net ([65.99.215.13]:60817) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBonb-0003ql-5C for 8996@debbugs.gnu.org; Sun, 25 Mar 2012 10:52:18 -0400 Received: from [87.198.47.36] (87-198-47-36.ptr.magnet.ie [87.198.47.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id E39AC683CF; Sun, 25 Mar 2012 15:20:57 +0100 (IST) Message-ID: <4F6F29C8.50602@harpegolden.net> Date: Sun, 25 Mar 2012 15:20:56 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: Chong Yidong Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> <4F6E91DB.30200@harpegolden.net> In-Reply-To: <4F6E91DB.30200@harpegolden.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 25/03/12 04:32, David De La Harpe Golden wrote: > Maybe there could be an extensible select-inhibit-commands-list, > and users who do such things could be told to push their command onto > it...) I suppose you'd prefer to settle on a solution this weekend given the announced regressions-only, and I'm now unlikely to finish a probably-overengineered stab at a temporal-because-actually-timestamped approach today, and, well, the old approach I sent was a tad ugly too, so... If such a postcommand-select-inhibit-list* defvar** was introduced and checked against instead of just hardcoding the two handle-select-window and handle-switch-frame, then whether or not you decide other-window also belongs on such a list by default, I could at least push other-window (and any other commands I encounter where it seems desirable) onto the list in my own ~/.emacs and reduce my local patching load... * or whatever you want to call it. ** Making something so niche a visible defcustom might be a bit much. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 26 00:38:34 2012 Received: (at 8996) by debbugs.gnu.org; 26 Mar 2012 04:38:34 +0000 Received: from localhost ([127.0.0.1]:38886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1hO-00081h-Qd for submit@debbugs.gnu.org; Mon, 26 Mar 2012 00:38:34 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:42581) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SC1h7-00081L-Df for 8996@debbugs.gnu.org; Mon, 26 Mar 2012 00:38:28 -0400 Received: from bb121-7-229-226.singnet.com.sg ([121.7.229.226]:35242 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SC1Cx-0005Md-QC; Mon, 26 Mar 2012 00:07:04 -0400 From: Chong Yidong To: David De La Harpe Golden Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> <4F6E91DB.30200@harpegolden.net> <4F6F29C8.50602@harpegolden.net> Date: Mon, 26 Mar 2012 12:06:57 +0800 In-Reply-To: <4F6F29C8.50602@harpegolden.net> (David De La Harpe Golden's message of "Sun, 25 Mar 2012 15:20:56 +0100") Message-ID: <87r4wgxaxq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) David De La Harpe Golden writes: > If such a postcommand-select-inhibit-list* defvar** was introduced and > checked against instead of just hardcoding the two > handle-select-window and handle-switch-frame, then whether or not you > decide other-window also belongs on such a list by default, I could at > least push other-window (and any other commands I encounter where it > seems desirable) onto the list in my own ~/.emacs and reduce my local > patching load... OK, I've committed a variable selection-inhibit-update-commands. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 26 20:48:11 2012 Received: (at 8996) by debbugs.gnu.org; 27 Mar 2012 00:48:11 +0000 Received: from localhost ([127.0.0.1]:40219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCKa2-0000XZ-Qc for submit@debbugs.gnu.org; Mon, 26 Mar 2012 20:48:11 -0400 Received: from harpegolden.net ([65.99.215.13]:53489) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCKZm-0000Wr-8h for 8996@debbugs.gnu.org; Mon, 26 Mar 2012 20:48:09 -0400 Received: from [87.198.47.38] (87-198-47-38.ptr.magnet.ie [87.198.47.38]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 3" (verified OK)) by harpegolden.net (Postfix) with ESMTPSA id ACBFE683F4; Tue, 27 Mar 2012 01:16:40 +0100 (IST) Message-ID: <4F7106E6.2000908@harpegolden.net> Date: Tue, 27 Mar 2012 01:16:38 +0100 From: David De La Harpe Golden User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120324 Icedove/10.0.3 MIME-Version: 1.0 To: Chong Yidong Subject: Re: bug#8996: Set PRIMARY from last selection, not last selected window References: <4E121079.6020103@harpegolden.net> <8739illrkc.fsf@stupidchicken.com> <4E169B83.4050706@harpegolden.net> <4E1A6689.1040203@harpegolden.net> <87pqc2b6f6.fsf@gnu.org> <4F6E91DB.30200@harpegolden.net> <4F6F29C8.50602@harpegolden.net> <87r4wgxaxq.fsf@gnu.org> In-Reply-To: <87r4wgxaxq.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 8996 Cc: 8996@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 26/03/12 05:06, Chong Yidong wrote: > OK, I've committed a variable selection-inhibit-update-commands. Right so, thanks. Seems to work fine, and it is useful to me to be able to add entries, anyway: FWIW, in the past day of emacs use, apart from 'handle-select-window and 'handle-switch-frame, 'other-window was indeed the main case I ran into, but 'other-frame got added too. 'delete-window (and 'delete-frame too) also got pushed onto the list quickly: I was sometimes selecting something in a window then deleting that window immediately afterward, and then of course, without 'delete-window on the list, primary would then be replaced by whatever region in whatever remaining window got (re)activated, losing whatever I had expected to be in primary. Haven't felt an urge to add anything else as yet, but I guess I only use a fairly small working set of emacs commands, and of course in turn the issue will only apply to a few of them. I suppose more emacs-idiomatic use of the kill-ring would have meant I didn't encounter as many problems, so my own usage quirks aren't blameless. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 30 01:01:30 2012 Received: (at control) by debbugs.gnu.org; 30 Mar 2012 05:01:31 +0000 Received: from localhost ([127.0.0.1]:45772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDTxp-0003fd-Rs for submit@debbugs.gnu.org; Fri, 30 Mar 2012 01:01:30 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:36672) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SDTxN-0003ej-0y for control@debbugs.gnu.org; Fri, 30 Mar 2012 01:01:28 -0400 Received: from bb121-6-72-34.singnet.com.sg ([121.6.72.34]:53607 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SDTSr-0003eJ-Gp for control@debbugs.gnu.org; Fri, 30 Mar 2012 00:29:30 -0400 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 8996 Date: Fri, 30 Mar 2012 12:29:18 +0800 Message-ID: <87ty16pv8h.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) close 8996 thanks From unknown Fri Aug 15 12:45:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 27 Apr 2012 11:24:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator