From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.devel Subject: Re: clipboard/selection: customization vs. rebinding Date: Fri, 01 Jul 2011 06:12:44 +0100 Message-ID: <4E0D574C.8000407@harpegolden.net> References: <4E07A0DB.7030503@harpegolden.net> <87d3hz5kp7.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010303050704060707090402" X-Trace: dough.gmane.org 1309499203 23259 80.91.229.12 (1 Jul 2011 05:46:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 1 Jul 2011 05:46:43 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 01 07:46:39 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QcWYn-0006wa-8X for ged-emacs-devel@m.gmane.org; Fri, 01 Jul 2011 07:46:37 +0200 Original-Received: from localhost ([::1]:46913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcWYm-0006rk-IL for ged-emacs-devel@m.gmane.org; Fri, 01 Jul 2011 01:46:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcW26-0007mh-4x for emacs-devel@gnu.org; Fri, 01 Jul 2011 01:12:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcW24-0006Ap-2J for emacs-devel@gnu.org; Fri, 01 Jul 2011 01:12:49 -0400 Original-Received: from harpegolden.net ([65.99.215.13]:58341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcW23-0006AP-PJ for emacs-devel@gnu.org; Fri, 01 Jul 2011 01:12:47 -0400 Original-Received: from [87.198.47.39] (87-198-47-39.ptr.magnet.ie [87.198.47.39]) (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 58C12683D8 for ; Fri, 1 Jul 2011 06:12:46 +0100 (IST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110606 Icedove/3.1.10 In-Reply-To: <87d3hz5kp7.fsf@stupidchicken.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 65.99.215.13 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141314 Archived-At: This is a multi-part message in MIME format. --------------010303050704060707090402 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 27/06/11 16:59, Chong Yidong wrote: > David De La Harpe Golden 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. --------------010303050704060707090402 Content-Type: text/x-patch; name="customization_for_mouse_yank.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="customization_for_mouse_yank.diff" === 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) --------------010303050704060707090402--