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: Selection changes Date: Sun, 25 Jul 2010 17:32:19 +0100 Message-ID: <4C4C6713.2070608@harpegolden.net> References: <87ocea2ax1.fsf@stupidchicken.com> <4C40FCEC.9030404@harpegolden.net> <87pqym2a4r.fsf@catnip.gol.com> <4C411552.40003@harpegolden.net> <87eif2n7d7.fsf@stupidchicken.com> <878w5a23ax.fsf@catnip.gol.com> <04B92DEADC9D46F38CB42B91679795DE@us.oracle.com> <87k4onmatk.fsf@stupidchicken.com> <83wrsmtrn5.fsf@gnu.org> <4C4B347D.7020608@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040708010401070107080503" X-Trace: dough.gmane.org 1280075612 22717 80.91.229.12 (25 Jul 2010 16:33:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 25 Jul 2010 16:33:32 +0000 (UTC) To: emacs-devel@gnu.org, Chong Yidong , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 25 18:33:28 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Od48m-00064S-4b for ged-emacs-devel@m.gmane.org; Sun, 25 Jul 2010 18:33:28 +0200 Original-Received: from localhost ([127.0.0.1]:53097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Od48l-0003x2-FT for ged-emacs-devel@m.gmane.org; Sun, 25 Jul 2010 12:33:27 -0400 Original-Received: from [140.186.70.92] (port=60291 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Od47l-0003lQ-Nm for emacs-devel@gnu.org; Sun, 25 Jul 2010 12:32:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Od47k-0005xE-FR for emacs-devel@gnu.org; Sun, 25 Jul 2010 12:32:25 -0400 Original-Received: from harpegolden.net ([65.99.215.13]:53095) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Od47i-0005sz-28; Sun, 25 Jul 2010 12:32:22 -0400 Original-Received: from [87.198.55.209] (87-198-55-209.ptr.magnet.ie [87.198.55.209]) (using TLSv1 with cipher DHE-RSA-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 6A46F68395; Sun, 25 Jul 2010 17:32:18 +0100 (IST) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100620 Icedove/3.0.5 In-Reply-To: <4C4B347D.7020608@harpegolden.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127767 Archived-At: This is a multi-part message in MIME format. --------------040708010401070107080503 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 24/07/10 19:44, David De La Harpe Golden wrote: > AFAIK the use of rebinding (mouse-2, menu-bar) rather than rewriting the > existing functions to which they were bound to honour some additional > customization booleans (as in some earlier iterations of this...) does > make it impossible to use pure customization theme functionality to > encapsulate the changes. > Perhaps reverting the rebinding of mouse-2, but then expanding mouse-yank-at-click to honour a boolean customization mouse-yank-selection-only would be best? This would certainly simplify instructing users on how to switch between the old and new behaviours (and I guess we can expect more tickets in the tracker in that area): it becomes possible to switch the behaviours solely by changing a small set of all-boolean customizations. Thhis also means other bindings to mouse-yank-at-click (such as in the fringes, or done by 3rd party apps or end users) get the behaviour. (*apart from the menu, though maybe users most likely to want the "classic" behaviour are least likely to be heavy menu users) --------------040708010401070107080503 Content-Type: text/x-patch; name="mouseyank_selonly.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mouseyank_selonly.diff" === modified file 'lisp/mouse.el' --- lisp/mouse.el 2010-07-17 20:21:51 +0000 +++ lisp/mouse.el 2010-07-25 16:27:46 +0000 @@ -47,6 +47,16 @@ :version "24.1" :group 'mouse) +(defcustom mouse-yank-selection-only t + "If non-nil, mouse yank inserts the current selection only. + +If nil, then the text that is inserted is the same as that which +a keyboard `yank' would insert, which itself varies according to +`x-select-enable-primary' and `x-select-enable-clipboard'" + :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. @@ -1247,25 +1257,30 @@ (max (point) click-posn))))) (defun mouse-yank-at-click (click arg) - "Insert the last stretch of killed text at the position clicked on. + "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. Prefix arguments are interpreted as with \\[yank]. +If `mouse-yank-selection-only' is non-nil, delegate click to +`mouse-yank-primary' (arg ignored in that case). If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click. If `select-active-regions' is non-nil, the mark is deactivated before inserting the text." (interactive "e\nP") ;; Give temporary modes such as isearch a chance to turn off. - (run-hooks 'mouse-leave-buffer-hook) - (when select-active-regions - ;; Without this, confusing things happen upon e.g. inserting into - ;; the middle of an active region. - (deactivate-mark)) - (or mouse-yank-at-point (mouse-set-point click)) - (setq this-command 'yank) - (setq mouse-selection-click-count 0) - (yank arg)) + (if mouse-yank-selection-only + (mouse-yank-primary click) + (progn + (run-hooks 'mouse-leave-buffer-hook) + (when select-active-regions + ;; Without this, confusing things happen upon e.g. inserting into + ;; the middle of an active region. + (deactivate-mark)) + (or mouse-yank-at-point (mouse-set-point click)) + (setq this-command 'yank) + (setq mouse-selection-click-count 0) + (yank arg)))) (defun mouse-yank-primary (click) "Insert the primary selection at the position clicked on. @@ -2441,7 +2456,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) --------------040708010401070107080503--