all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* clipboard/selection: customization vs. rebinding
@ 2011-06-26 21:12 David De La Harpe Golden
  2011-06-27 15:59 ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: David De La Harpe Golden @ 2011-06-26 21:12 UTC (permalink / raw)
  To: Emacs developers

As a feature freeze is rapidly coming up, I'd like (...for some value of 
like...) to raise this one more time:

I remain concerned it's too hard to revert to "classic" emacs behaviour 
absent any UI for rebinding beyond "use emacs lisp". Right now, there's 
a mix of customization variable adjustments and a rebinding involved.

It's unlikely that a general customization-type UI for bindings will 
appear in the immediate future, so I propose for 24 binding mouse-2 back 
to mouse-yank-at-click but with the addition of boolean customization to 
control the precise behaviour to allow the desired fd.o-type behaviour. 
  Then one need only adjust customization variables to select between 
the classic and fd.o-type behaviours, rather than both customization 
variables and global bindings, which has been a source of confusion and 
misunderstanding (especially on platforms without a primary).

OTOH, if the mouse-2 binding is not reverted to mouse-yank-at-click, 
then note there are other binding sites that will need adjustment to 
mouse-yank-primary to match the new binding of mouse-2 for consistency 
(e.g. the fringes, where mouse-2 still does a mouse-yank-at-click).








^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-06-26 21:12 clipboard/selection: customization vs. rebinding David De La Harpe Golden
@ 2011-06-27 15:59 ` Chong Yidong
  2011-06-29  3:19   ` Stefan Monnier
  2011-07-01  5:12   ` David De La Harpe Golden
  0 siblings, 2 replies; 7+ messages in thread
From: Chong Yidong @ 2011-06-27 15:59 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: Emacs developers

David De La Harpe Golden <david@harpegolden.net> writes:

> I propose for 24 binding mouse-2 back to mouse-yank-at-click but with
> the addition of boolean customization to control the precise behaviour
> to allow the desired fd.o-type behaviour.

It's a tough decision.  It's true that mouse-yank-at-click has fringe
bindings, so anyone who wants the old behavior would need to rebind
those too, which is a nuisance.

However, if we introduce a boolean to control mouse-yank-at-click, that
makes it harder for users to have both mouse yank behaviors available
(by binding mouse-yank-at-click and mouse-yank-primary to different
keys)---unless we introduce yet another command that unconditionally
yanks from the kill ring, which I think is not worth the complication.

All in all, I think it's better to change the fringe bindings to
mouse-yank-primary.  For those users who are set on the old behavior,
the minor inconvenience of adding a few extra key bindings is
regrettable but not worth making the proposed change.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-06-27 15:59 ` Chong Yidong
@ 2011-06-29  3:19   ` Stefan Monnier
  2011-06-29 16:08     ` Chong Yidong
  2011-07-01  5:12   ` David De La Harpe Golden
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2011-06-29  3:19 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Emacs developers, David De La Harpe Golden

> It's a tough decision.  It's true that mouse-yank-at-click has fringe
> bindings, so anyone who wants the old behavior would need to rebind
> those too, which is a nuisance.

Shouldn't we do something like the patch below?

> However, if we introduce a boolean to control mouse-yank-at-click, that
> makes it harder for users to have both mouse yank behaviors available
> (by binding mouse-yank-at-click and mouse-yank-primary to different
> keys)---unless we introduce yet another command that unconditionally
> yanks from the kill ring, which I think is not worth the complication.

It doesn't seem that terrible, but I also don't think it matters that
much either way (i.e. I think the main problem with the new behavior is
that C-y now never inserts the primary).


        Stefan


=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2011-06-01 16:10:20 +0000
+++ lisp/mouse.el	2011-06-29 03:17:30 +0000
@@ -2092,16 +2092,16 @@
 ;; (global-set-key [triple-mouse-1] 'mouse-set-point)
 
 ;; Clicking on the fringes causes hscrolling:
-(global-set-key [left-fringe mouse-1]	'mouse-set-point)
-(global-set-key [right-fringe mouse-1]	'mouse-set-point)
+(global-set-key [left-fringe mouse-1]	[mouse-1])
+(global-set-key [right-fringe mouse-1]	[mouse-1])
 
 (global-set-key [mouse-2]	'mouse-yank-primary)
 ;; Allow yanking also when the corresponding cursor is "in the fringe".
-(global-set-key [right-fringe mouse-2] 'mouse-yank-at-click)
-(global-set-key [left-fringe mouse-2] 'mouse-yank-at-click)
+(global-set-key [right-fringe mouse-2] [mouse-2])
+(global-set-key [left-fringe mouse-2] [mouse-2])
 (global-set-key [mouse-3]	'mouse-save-then-kill)
-(global-set-key [right-fringe mouse-3]	'mouse-save-then-kill)
-(global-set-key [left-fringe mouse-3]	'mouse-save-then-kill)
+(global-set-key [right-fringe mouse-3]	[mouse-3])
+(global-set-key [left-fringe mouse-3]	[mouse-3])
 
 ;; By binding these to down-going events, we let the user use the up-going
 ;; event to make the selection, saving a click.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-06-29  3:19   ` Stefan Monnier
@ 2011-06-29 16:08     ` Chong Yidong
  2011-06-30 16:57       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2011-06-29 16:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers, David De La Harpe Golden

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Shouldn't we do something like the patch below?
>
> -(global-set-key [left-fringe mouse-1]	'mouse-set-point)
> -(global-set-key [right-fringe mouse-1]	'mouse-set-point)
> +(global-set-key [left-fringe mouse-1]	[mouse-1])
> +(global-set-key [right-fringe mouse-1]	[mouse-1])

That doesn't work for mouse-yank-primary.  Binding [left-fringe mouse-2]
to [mouse-2], and doing mouse-2 in the fringe, gives an error:

Debugger entered--Lisp error: (error "mouse-yank-primary must be bound
to an event with parameters")
  call-interactively(mouse-yank-primary nil nil)

The problem is that mouse events are not passed along to keyboard macro
bindings.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-06-29 16:08     ` Chong Yidong
@ 2011-06-30 16:57       ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2011-06-30 16:57 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Emacs developers, David De La Harpe Golden

>> Shouldn't we do something like the patch below?
>> 
>> -(global-set-key [left-fringe mouse-1]	'mouse-set-point)
>> -(global-set-key [right-fringe mouse-1]	'mouse-set-point)
>> +(global-set-key [left-fringe mouse-1]	[mouse-1])
>> +(global-set-key [right-fringe mouse-1]	[mouse-1])

> That doesn't work for mouse-yank-primary.  Binding [left-fringe mouse-2]
> to [mouse-2], and doing mouse-2 in the fringe, gives an error:

> Debugger entered--Lisp error: (error "mouse-yank-primary must be bound
> to an event with parameters")
>   call-interactively(mouse-yank-primary nil nil)

> The problem is that mouse events are not passed along to keyboard macro
> bindings.

Hmm... so maybe we should do

   (define-key function-key-map [left-fringe mouse-2] [mouse-2])

instead.  The point is simply that by default clicks in the fringe
should fallback to doing the same as clicks in the text area.


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-06-27 15:59 ` Chong Yidong
  2011-06-29  3:19   ` Stefan Monnier
@ 2011-07-01  5:12   ` David De La Harpe Golden
  2011-07-03 18:30     ` Chong Yidong
  1 sibling, 1 reply; 7+ messages in thread
From: David De La Harpe Golden @ 2011-07-01  5:12 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

On 27/06/11 16:59, Chong Yidong wrote:
> David De La Harpe Golden<david@harpegolden.net>  writes:
>
>> I propose for 24 binding mouse-2 back to mouse-yank-at-click but with
>> the addition of boolean customization to control the precise behaviour
>> to allow the desired fd.o-type behaviour.
>
> It's a tough decision.  It's true that mouse-yank-at-click has fringe
> bindings, so anyone who wants the old behavior would need to rebind
> those too, which is a nuisance.
>
> However, if we introduce a boolean to control mouse-yank-at-click, that
> makes it harder for users to have both mouse yank behaviors available
> (by binding mouse-yank-at-click and mouse-yank-primary to different
> keys)---unless we introduce yet another command that unconditionally
> yanks from the kill ring, which I think is not worth the complication.
>

Hmm. actually, that command sort of already exists in the form of the 
existing mount-yank-at-click? It really "yanks from the kill-ring" - 
though that process can check the system clipboard and/or primary and 
pushing them onto the kill ring, according to x-select-enable-primary 
and x-select-enable-clipboard.

So just introducing a new mouse-yank-at-click that redirects to one of 
mouse-yank-primary or mouse-yank-last-kill (the old mouse-yank-at-click, 
renamed) depending on a customization, does achieve what I
was proposing.  Though you may still think it too messy / not worth the 
complication.


[-- Attachment #2: customization_for_mouse_yank.diff --]
[-- Type: text/x-patch, Size: 1734 bytes --]

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2011-06-01 15:34:41 +0000
+++ lisp/mouse.el	2011-07-01 04:54:25 +0000
@@ -50,6 +50,16 @@
   :version "24.1"
   :group 'mouse)
 
+
+(defcustom mouse-yank-from-kill-ring nil
+  "If non-nil, `mouse-yank-at-click' yanks the last killed text.
+
+If nil, only the most recently selected text is inserted."
+  :type 'boolean
+  :version "24.1"
+  :group 'mouse)
+
+
 (defcustom mouse-1-click-follows-link 450
   "Non-nil means that clicking Mouse-1 on a link follows the link.
 
@@ -1240,7 +1250,21 @@
 	(kill-region (min (point) click-posn)
 		     (max (point) click-posn)))))
 
+
 (defun mouse-yank-at-click (click arg)
+  "Insert the most recently selected text at the position clicked on.
+
+If `mouse-yank-from-kill-ring` is non-nil, instead insert the last
+stretch of killed text at the position clicked on.
+
+If `mouse-yank-at-point' is non-nil, insert at point
+regardless of where you click."
+  (interactive "e\nP")
+  (if mouse-yank-from-kill-ring
+      (mouse-yank-last-kill click arg)
+    (mouse-yank-primary click)))
+
+(defun mouse-yank-last-kill (click arg)
   "Insert the last stretch of killed text at the position clicked on.
 Also move point to one end of the text thus inserted (normally the end),
 and set mark at the beginning.
@@ -2096,7 +2120,7 @@
 (global-set-key [left-fringe mouse-1]	'mouse-set-point)
 (global-set-key [right-fringe mouse-1]	'mouse-set-point)
 
-(global-set-key [mouse-2]	'mouse-yank-primary)
+(global-set-key [mouse-2]	'mouse-yank-at-click)
 ;; Allow yanking also when the corresponding cursor is "in the fringe".
 (global-set-key [right-fringe mouse-2] 'mouse-yank-at-click)
 (global-set-key [left-fringe mouse-2] 'mouse-yank-at-click)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: clipboard/selection: customization vs. rebinding
  2011-07-01  5:12   ` David De La Harpe Golden
@ 2011-07-03 18:30     ` Chong Yidong
  0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2011-07-03 18:30 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: emacs-devel

David De La Harpe Golden <david@harpegolden.net> writes:

> Hmm. actually, that command sort of already exists in the form of the
> existing mount-yank-at-click? It really "yanks from the kill-ring" -
> though that process can check the system clipboard and/or primary and
> pushing them onto the kill ring, according to x-select-enable-primary
> and x-select-enable-clipboard.
>
> So just introducing a new mouse-yank-at-click that redirects to one of
> mouse-yank-primary or mouse-yank-last-kill (the old
> mouse-yank-at-click, renamed) depending on a customization, does
> achieve what I was proposing.  Though you may still think it too messy
> / not worth the complication.

Yeah, I don't think it's worth introducing this additional complication;
now that Stefan introduced mouse--strip-first-event, only one rebinding
is necessary for those users who demand the old behavior.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-03 18:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-26 21:12 clipboard/selection: customization vs. rebinding David De La Harpe Golden
2011-06-27 15:59 ` Chong Yidong
2011-06-29  3:19   ` Stefan Monnier
2011-06-29 16:08     ` Chong Yidong
2011-06-30 16:57       ` Stefan Monnier
2011-07-01  5:12   ` David De La Harpe Golden
2011-07-03 18:30     ` Chong Yidong

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.