all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David De La Harpe Golden <david@harpegolden.net>
To: emacs-devel@gnu.org
Subject: Re: clipboard/selection: customization vs. rebinding
Date: Fri, 01 Jul 2011 06:12:44 +0100	[thread overview]
Message-ID: <4E0D574C.8000407@harpegolden.net> (raw)
In-Reply-To: <87d3hz5kp7.fsf@stupidchicken.com>

[-- 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)


  parent reply	other threads:[~2011-07-01  5:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-07-03 18:30     ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E0D574C.8000407@harpegolden.net \
    --to=david@harpegolden.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.