* The X window system, yanking, and pasting using the mouse @ 2011-01-27 2:31 Manoj Srivastava 2011-01-27 2:39 ` Miles Bader ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Manoj Srivastava @ 2011-01-27 2:31 UTC (permalink / raw) To: emacs-devel Hi, I have read the archives of this mailing list, and the release notes of the latest release candidate, and I am left somewhat confused. I am using the latest Emacs from Git. This is what I have: --8<---------------cut here---------------start------------->8--- (setq transient-mark-mode t ;show the marked region ;;; Behave like other X applications. This is confusing. x-select-enable-primary t x-select-enable-clipboard t ;;; cut/paste use clipboard select-active-regions 'only ;;; temporarily active regions set the ;;; window selection. mouse-drag-copy-region t ;;; copy dragged region to kill ring ) --8<---------------cut here---------------end--------------->8--- What I want is the behaviour I think I used to have in Emacs on GNU/Linux X Windows: 1) Whatever text is pasted when I click <down-mouse-2> (mouse-yank-primary?) should be the same thing yanked when I type C-y (yank) 2) Conversely, text that is selected in Emacs, such that it is inserted with a C-y (yank) should also be the text that is pasted into, say, an xterm when I do a middle mouse click in there. I often find that text selected in other X applications (which is inserted in xterms and Emacs using the middle mouse button, is not what is yanked using the keyboard. I cannot seem to reproduce this reliably, but I have observed this often. In Emacs, I select text by: 1) C-SPC (set-mark-command) C-f C-f M-w (kill-ring-save) 2) Down-mouse-1 drag-mouse-1 up-mouse-one (mouse-drag-region) 3) Down-mouse-1 Down-mouse-3 (mouse-save-then-kill I would like each of these methods to copy things over so that a middle mouse click in an xterm to paste the text in the region. What changes do I need to make to get this? manoj -- New systems generate new problems. Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/> 4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20 05B6 CF48 9438 C577 9A1C ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 2:31 The X window system, yanking, and pasting using the mouse Manoj Srivastava @ 2011-01-27 2:39 ` Miles Bader 2011-01-27 3:33 ` Manoj Srivastava 2011-01-27 6:56 ` Eli Zaretskii 2011-01-27 21:35 ` David De La Harpe Golden 2 siblings, 1 reply; 12+ messages in thread From: Miles Bader @ 2011-01-27 2:39 UTC (permalink / raw) To: emacs-devel Manoj Srivastava <srivasta@ieee.org> writes: > What I want is the behaviour I think I used to have in Emacs on > GNU/Linux X Windows: > 1) Whatever text is pasted when I click <down-mouse-2> > (mouse-yank-primary?) should be the same thing yanked when I type > C-y (yank) > 2) Conversely, text that is selected in Emacs, such that it is > inserted with a C-y (yank) should also be the text that is pasted > into, say, an xterm when I do a middle mouse click in there. I agree, this was very nice behavior. > What changes do I need to make to get this? I've not found a tenable way to simulate the old behavior with the new code. -Miles -- Dawn, n. When men of reason go to bed. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 2:39 ` Miles Bader @ 2011-01-27 3:33 ` Manoj Srivastava 2011-01-27 7:49 ` Stefan Reichör 0 siblings, 1 reply; 12+ messages in thread From: Manoj Srivastava @ 2011-01-27 3:33 UTC (permalink / raw) To: emacs-devel On Wed, Jan 26 2011, Miles Bader wrote: > Manoj Srivastava <srivasta@ieee.org> writes: >> What I want is the behaviour I think I used to have in Emacs on >> GNU/Linux X Windows: >> 1) Whatever text is pasted when I click <down-mouse-2> >> (mouse-yank-primary?) should be the same thing yanked when I type >> C-y (yank) >> 2) Conversely, text that is selected in Emacs, such that it is >> inserted with a C-y (yank) should also be the text that is pasted >> into, say, an xterm when I do a middle mouse click in there. > > I agree, this was very nice behavior. > >> What changes do I need to make to get this? > > I've not found a tenable way to simulate the old behavior with the new > code. I would say that this is a regression, then. Before the new code, I never had to worry about primary and secondary selections; and pasting using a mouse was the same as yanking, and text selected in Emacs could easily be passed around to other X Windows applications. Is there a possibility for this regression to be fixed? If I recall correctly, the new code was supposed to preserve the old features, and that does not seem to be the case here. manoj -- "Only a mediocre man is always at his best." Somerset Maugham Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/> 4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20 05B6 CF48 9438 C577 9A1C ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 3:33 ` Manoj Srivastava @ 2011-01-27 7:49 ` Stefan Reichör 0 siblings, 0 replies; 12+ messages in thread From: Stefan Reichör @ 2011-01-27 7:49 UTC (permalink / raw) To: emacs-devel Manoj Srivastava <srivasta@ieee.org> writes: > On Wed, Jan 26 2011, Miles Bader wrote: > >> Manoj Srivastava <srivasta@ieee.org> writes: >>> What I want is the behaviour I think I used to have in Emacs on >>> GNU/Linux X Windows: >>> 1) Whatever text is pasted when I click <down-mouse-2> >>> (mouse-yank-primary?) should be the same thing yanked when I type >>> C-y (yank) >>> 2) Conversely, text that is selected in Emacs, such that it is >>> inserted with a C-y (yank) should also be the text that is pasted >>> into, say, an xterm when I do a middle mouse click in there. >> >> I agree, this was very nice behavior. >> >>> What changes do I need to make to get this? >> >> I've not found a tenable way to simulate the old behavior with the new >> code. > > I would say that this is a regression, then. Before the new > code, I never had to worry about primary and secondary selections; and > pasting using a mouse was the same as yanking, and text selected in > Emacs could easily be passed around to other X Windows applications. > > Is there a possibility for this regression to be fixed? If I > recall correctly, the new code was supposed to preserve the old > features, and that does not seem to be the case here. I use the same settings as Manoj. The thing that annoys me is replacing text. Whenever I select something and want to replace it with the X-Selection. It replaces it with the new (now selected X-Selection). That means there is no change and I have to use C-y M-y Before I could just use C-y Stefan. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 2:31 The X window system, yanking, and pasting using the mouse Manoj Srivastava 2011-01-27 2:39 ` Miles Bader @ 2011-01-27 6:56 ` Eli Zaretskii 2011-01-27 10:36 ` Manoj Srivastava 2011-01-27 21:35 ` David De La Harpe Golden 2 siblings, 1 reply; 12+ messages in thread From: Eli Zaretskii @ 2011-01-27 6:56 UTC (permalink / raw) To: Manoj Srivastava; +Cc: emacs-devel > From: Manoj Srivastava <srivasta@ieee.org> > Date: Wed, 26 Jan 2011 18:31:16 -0800 > Mail-Copies-To: never > > In Emacs, I select text by: > 1) C-SPC (set-mark-command) C-f C-f M-w (kill-ring-save) > 2) Down-mouse-1 drag-mouse-1 up-mouse-one (mouse-drag-region) > 3) Down-mouse-1 Down-mouse-3 (mouse-save-then-kill > > I would like each of these methods to copy things over so that a > middle mouse click in an xterm to paste the text in the region. > > What changes do I need to make to get this? This is supposed to be explained in NEWS, under "Selection changes". It includes a paragraph on how to restore pre-Emacs 24 behavior. If something is unclear or doesn't work as explained there, please submit specific bug reports. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 6:56 ` Eli Zaretskii @ 2011-01-27 10:36 ` Manoj Srivastava 2011-01-27 21:41 ` Chong Yidong 0 siblings, 1 reply; 12+ messages in thread From: Manoj Srivastava @ 2011-01-27 10:36 UTC (permalink / raw) To: emacs-devel On Wed, Jan 26 2011, Eli Zaretskii wrote: >> From: Manoj Srivastava <srivasta@ieee.org> >> Date: Wed, 26 Jan 2011 18:31:16 -0800 >> Mail-Copies-To: never >> >> In Emacs, I select text by: >> 1) C-SPC (set-mark-command) C-f C-f M-w (kill-ring-save) >> 2) Down-mouse-1 drag-mouse-1 up-mouse-one (mouse-drag-region) >> 3) Down-mouse-1 Down-mouse-3 (mouse-save-then-kill >> >> I would like each of these methods to copy things over so that a >> middle mouse click in an xterm to paste the text in the region. >> >> What changes do I need to make to get this? > > This is supposed to be explained in NEWS, under "Selection changes". > It includes a paragraph on how to restore pre-Emacs 24 behavior. If > something is unclear or doesn't work as explained there, please submit > specific bug reports. I'll bite. I'll try to explain why the text below is confusing to me. So, the section starts of by saying mouse commands use the primary selection, all others use the clipboard. This is clear. The X windows application I am using as an example, xterm, sets and pastes from the primary selection. So my assumption was that the behaviour I want can thus be achieved by making everything just use the primary selection; this way when I select using the mouse in an xterm, which copies it to the primary selection, and then hit C-y, it will yank the primary selection. This was the old behaviour. Reading further, I can see that the new behaviour makes the Commands that kill text or copy it to the kill-ring (M-w, C-w, C-k, etc.) also put the killed text into the clipboard (apart from the kill ring). There is no way described to make them go back to just using the primary selection. Indeed, the last paragraph states that setting `mouse-drag-copy-region' and `x-select-enable-primary' would make the mouse use the clipboard -- not what I want. However, the actual behaviour is different. With: mouse-drag-copy-region t select-active-regions nil x-select-enable-clipboard t x-select-enable-primary t |------------------------+---------+------| | action | Primary | clip | |------------------------+---------+------| | Use M-w | Set | Set | | mouse drag in Emacs | Set | Set | | mouse-save-then-kill | Set | Set | |------------------------+---------+------| | Mouse drag in Xterm | Set | | | left click/right click | Set | | |------------------------+---------+------| Flipping x-select-enable-clipboard to nil, |------------------------+---------+------| | action | Primary | clip | |------------------------+---------+------| | Use M-w | Set | | | mouse drag in Emacs | Set | | | mouse-save-then-kill | Set | | |------------------------+---------+------| | Mouse drag in Xterm | Set | | | left click/right click | Set | | |------------------------+---------+------| So the way to have everything just use the Primary selection (*NOT* the clipboard, one needs just set: (setq mouse-drag-copy-region t select-active-regions nil x-select-enable-clipboard nil x-select-enable-primary t ) If the following bit was clarified: --8<---------------cut here---------------start------------->8--- **** `select-active-regions' now defaults to t. It also accepts a new value, `only', which means to only set the primary selection for temporarily active regions (usually made by mouse-dragging or shift-selection). --8<---------------cut here---------------end--------------->8--- Does it mean: a) temporarily active regions will only set primary selection (and not the clipboard), or b) the primary selection is only set by temporarily active regions, and never else? In either case, this does not match my experience: even with select-active-regions nil the primary selection is being set (perhaps due to x-select-enable-primary and mouse-drag-copy-region set to t) Also, the final paragraph needs to be corrected: --8<---------------cut here---------------start------------->8--- *** To return to the previous behavior, where mouse commands use the clipboard, change `mouse-drag-copy-region' and (on X only) `x-select-enable-primary' to t. --8<---------------cut here---------------end--------------->8--- s/clipboard/primary selection/ manoj -- Wow, I'm being shot at from both sides. That means I *must* be right. :-) Larry Wall in <199710211959.MAA18990@wall.org> Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/> 4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20 05B6 CF48 9438 C577 9A1C ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 10:36 ` Manoj Srivastava @ 2011-01-27 21:41 ` Chong Yidong 0 siblings, 0 replies; 12+ messages in thread From: Chong Yidong @ 2011-01-27 21:41 UTC (permalink / raw) To: emacs-devel Manoj Srivastava <srivasta@ieee.org> writes: > Commands that kill text or copy it to the kill-ring (M-w, C-w, C-k, > etc.) also put the killed text into the clipboard (apart from the kill > ring). There is no way described to make them go back to just using the > primary selection. This is described further on. I've edited the entry to make this clearer. > **** `select-active-regions' now defaults to t. > It also accepts a new value, `only', which means to only set the > primary selection for temporarily active regions (usually made by > mouse-dragging or shift-selection). > > Does it mean: > a) temporarily active regions will only set primary selection (and not > the clipboard), or > b) the primary selection is only set by temporarily active regions, and > never else? The latter; I've edited this to make it clearer. > In either case, this does not match my experience: even with > select-active-regions nil the primary selection is being set (perhaps > due to x-select-enable-primary and mouse-drag-copy-region set to t) Mouse commands all make temporarily active regions. What the `only' setting distinguishes is the type of region you make with C-SPC following by moving point away from the mark. > Also, the final paragraph needs to be corrected: > *** To return to the previous behavior, where mouse commands use the > clipboard, change `mouse-drag-copy-region' and (on X only) > `x-select-enable-primary' to t. > > s/clipboard/primary selection/ Fixed, thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 2:31 The X window system, yanking, and pasting using the mouse Manoj Srivastava 2011-01-27 2:39 ` Miles Bader 2011-01-27 6:56 ` Eli Zaretskii @ 2011-01-27 21:35 ` David De La Harpe Golden 2011-01-28 8:42 ` Manoj Srivastava 2011-01-28 18:22 ` Drew Adams 2 siblings, 2 replies; 12+ messages in thread From: David De La Harpe Golden @ 2011-01-27 21:35 UTC (permalink / raw) To: emacs-devel On 27/01/11 02:31, Manoj Srivastava wrote: > Hi, > > I have read the archives of this mailing list, and the release > notes of the latest release candidate, and I am left somewhat > confused. I am using the latest Emacs from Git. > > This is what I have: > --8<---------------cut here---------------start------------->8--- > (setq > transient-mark-mode t ;show the marked region > ;;; Behave like other X applications. This is confusing. > x-select-enable-primary t > x-select-enable-clipboard t ;;; cut/paste use clipboard > select-active-regions 'only ;;; temporarily active regions set the > ;;; window selection. > mouse-drag-copy-region t ;;; copy dragged region to kill ring > ) *** It is necessary to bind mouse-2 to mouse-yank-at-click to restore old behaviour. It is NOT PRESENTLY POSSIBLE to restore historical emacs behaviour without a rebinding as well as customisation. That is not to say it /shouldn't/ be possible to use solely customisation to restore the historical behaviour - I have recommended mouse-2 be bound back to mouse-yank-at-click, and mouse-yank-at-click then expanded to support both the standards-compliant and historical emacs behaviour, depending on a customisation. Third party code and other binding sites (e.g. the fringes) also make this approach preferable IMNHO. All recent discussions of the matter on emacs-devel have convinced me that users /do not cope with rebinding/, even when directly told they need to rebind some of them simply refuse to do so. Possibly that's only because there's no GUI for keybinding reconfiguration, but that would be a large project compared to just reverting the mouse-2 binding and introducing the relevant boolean customisation. First place in your ~/.emacs: (global-set-key [mouse-2] 'mouse-yank-at-click) Then do: mouse-drag-copy-region t select-active-regions nil x-select-enable-primary t x-select-enable-clipboard nil I also acknowledge the customisations are confusing. I still do not see a way to make a saner scheme without breaking some source-code backward compatibility (n.b. a saner scheme should be possible with "user visible behaviour" backward compatibility.) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-27 21:35 ` David De La Harpe Golden @ 2011-01-28 8:42 ` Manoj Srivastava 2011-01-28 18:22 ` Drew Adams 1 sibling, 0 replies; 12+ messages in thread From: Manoj Srivastava @ 2011-01-28 8:42 UTC (permalink / raw) To: emacs-devel On Thu, Jan 27 2011, David De La Harpe Golden wrote: > First place in your ~/.emacs: > > (global-set-key [mouse-2] 'mouse-yank-at-click) > > Then do: > > mouse-drag-copy-region t > select-active-regions nil > x-select-enable-primary t > x-select-enable-clipboard nil > > I also acknowledge the customisations are confusing. I still do not > see a way to make a saner scheme without breaking some source-code > backward compatibility (n.b. a saner scheme should be possible with > "user visible behaviour" backward compatibility.) Thanks. If these instructions are added to NEWS, us old timers would be happy, I think. manoj -- To be sure of hitting the target, shoot first and, whatever you hit, call it the target. Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/> 4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20 05B6 CF48 9438 C577 9A1C ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: The X window system, yanking, and pasting using the mouse 2011-01-27 21:35 ` David De La Harpe Golden 2011-01-28 8:42 ` Manoj Srivastava @ 2011-01-28 18:22 ` Drew Adams 2011-01-28 19:59 ` Stefan Monnier 1 sibling, 1 reply; 12+ messages in thread From: Drew Adams @ 2011-01-28 18:22 UTC (permalink / raw) To: 'David De La Harpe Golden', emacs-devel `select-active-regions' is a bad name. An active region is always selected, by definition. (And there is only ever one active region, not several.) More importantly, this name says nothing about the primary selection, which is really what the option is all about IIUC. Please rename the option. One possible name is `autocopy-active-region-to-primary': a copy is made automatically, from the active region to the primary selection. And please avoid giving the impression that the primary selection is "the selection". Selected text in Emacs used to simply refer to the region. Now users need to distinguish various sorts of selection (selected text): primary selection, mouse selection, and region. And the region itself can be active or inactive, its text being selected in both cases. But sometimes users understand "selection" as only the highlighted text (which can be the mouse selection or the active region, but not the inactive region). Like the users, the doc and names now need to characterize carefully and not just speak of "selection" without qualification. Users also need to distinguish various operations for each kind of selection: yank vs paste, paste from the clipboard vs paste from the primary/mouse selection, etc. Currently the doc is a mess wrt sorting all of this out. The vocabulary used is inconsistent, ambiguous, and confusing. From bug #7702: d>> there is the problem of just what the relation is between d>> pasting and yanking.... Even just the notion of "pasting" d>> is not very clear. When you use `mouse-2' are you pasting? d>> Or is "pasting" reserved for something that is pasted from d>> the clipboard. Etc. - we need to be clearer about these terms. ez> ez> That's a different job, and a much larger one. I would ez> suggest a separate bug report, or maybe wait until Emacs 24 ez> is near its pretest.... explaining the difference is ez> hopelessly complicated, perhaps even impossible in Emacs 23. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-28 18:22 ` Drew Adams @ 2011-01-28 19:59 ` Stefan Monnier 2011-01-29 19:06 ` David De La Harpe Golden 0 siblings, 1 reply; 12+ messages in thread From: Stefan Monnier @ 2011-01-28 19:59 UTC (permalink / raw) To: Drew Adams; +Cc: emacs-devel, 'David De La Harpe Golden' > really what the option is all about IIUC. Please rename the option. One > possible name is `autocopy-active-region-to-primary': a copy is made > automatically, from the active region to the primary selection. That sounds like a good idea. Stefan ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: The X window system, yanking, and pasting using the mouse 2011-01-28 19:59 ` Stefan Monnier @ 2011-01-29 19:06 ` David De La Harpe Golden 0 siblings, 0 replies; 12+ messages in thread From: David De La Harpe Golden @ 2011-01-29 19:06 UTC (permalink / raw) To: Stefan Monnier; +Cc: Drew Adams, emacs-devel On 28/01/11 19:59, Stefan Monnier wrote: >> really what the option is all about IIUC. Please rename the option. One >> possible name is `autocopy-active-region-to-primary': a copy is made >> automatically, from the active region to the primary selection. > > That sounds like a good idea. > I'm certainly not averse to renaming it if people are happy to use the x11-specific terminology "[[window] system] primary" and "[[window] system] clipboard" instead of more neutral "[[window] system] selection", "[[window] system] clipboard" terminology. I did /suggest/ renaming some years ago owing to various confusions (and despite the fact it is demonstrably commonplace to refer to primary as "the" selection here in x11 land, it after all conventionally holds the most recently selected text - we see that in apps from KDE klipper to GNUstep's pasteboard daemon...) Care must be taken to layer the api, though, just because it's being referred to as "primary" doesn't mean you should short-circuit /asking the backend/ to update the system primary like you ask it to update the system clipboard. The x11 backend implementation would then update the primary x11-selection and the ns backend implementation the 'Selection' pasteboard. "autocopy" may be oversimplified given the lazy nature of the protocol involved on some platforms, though user-visible behaviour is such that it doesn't matter all that much. "map" might be a alternative that glosses over the lazy vs. eager issues of the different platforms if you want an explicit verb at all e.g. map-emacs-active-region-to-system-primary or just emacs-active-region-to-system-primary - explicit map-active-region-to-system-primary or just active-region-to-system-primary - after all, you don't encounter "active region" outside emacs jargon. map-active-region-to-primary or just active-region-to-primary - Short, but primary isn't rightly considered an emacs-level entity (even if it is emulated internally by emacs on some platforms), so I kind of like having "system" in there. (see, we'll likely eventually also want a map-active-region-to-system-clipboard for people who like that sort of thing, previously referred to as "clipboard-active-regions", especially since w32 doesn't have a system-primary) ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-01-29 19:06 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-01-27 2:31 The X window system, yanking, and pasting using the mouse Manoj Srivastava 2011-01-27 2:39 ` Miles Bader 2011-01-27 3:33 ` Manoj Srivastava 2011-01-27 7:49 ` Stefan Reichör 2011-01-27 6:56 ` Eli Zaretskii 2011-01-27 10:36 ` Manoj Srivastava 2011-01-27 21:41 ` Chong Yidong 2011-01-27 21:35 ` David De La Harpe Golden 2011-01-28 8:42 ` Manoj Srivastava 2011-01-28 18:22 ` Drew Adams 2011-01-28 19:59 ` Stefan Monnier 2011-01-29 19:06 ` David De La Harpe Golden
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.