From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#12819: 24.2.50; [PATCH] Fix inconsistent behavior of (append-next-kill) Date: Tue, 06 Nov 2012 15:33:39 -0800 Message-ID: <87txt2b92k.fsf@oblong.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1352247179 18821 80.91.229.3 (7 Nov 2012 00:12:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Nov 2012 00:12:59 +0000 (UTC) To: 12819@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 07 01:13:09 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TVtGQ-00064V-QU for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Nov 2012 01:13:03 +0100 Original-Received: from localhost ([::1]:41843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtGH-0000ef-PQ for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Nov 2012 19:12:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtGF-0000ea-5I for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:12:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVtGD-0004QE-Hz for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:12:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtGD-0004QA-Es for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:12:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TVtJK-0003st-Js for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Nov 2012 00:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12819 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135224736014922 (code B ref -1); Wed, 07 Nov 2012 00:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Nov 2012 00:16:00 +0000 Original-Received: from localhost ([127.0.0.1]:52989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TVtJI-0003sc-8p for submit@debbugs.gnu.org; Tue, 06 Nov 2012 19:16:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40554) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TVtHL-0003pI-Cu for submit@debbugs.gnu.org; Tue, 06 Nov 2012 19:14:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVtEC-0003mm-C9 for submit@debbugs.gnu.org; Tue, 06 Nov 2012 19:10:45 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:50876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtEC-0003mM-4e for submit@debbugs.gnu.org; Tue, 06 Nov 2012 19:10:44 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtEA-0000E7-MI for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:10:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TVtE8-0003m3-SI for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:10:42 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:55836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TVtE8-0003lv-K1 for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 19:10:40 -0500 Original-Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id E4F1520BA2 for ; Tue, 6 Nov 2012 18:34:51 -0500 (EST) Original-Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute5.internal (MEProxy); Tue, 06 Nov 2012 18:34:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=tdexPztk1ZARGj4c5Bhw0UW13nY=; b=c8UPu5GZVPso0floGC+/F QJPG0MEaZtPXjlgz+Njr+fkMamzpE8LGRlL2JCud+ZUDv1ymQeEsSXS/vAN2qqWS /HSM2RtgmOVhhdYmEy/nhL4BivJU6d7xpI2LM16WWPvY9xQU9ZheJju2U5l8Vc7o /TO7Il3uczsZnTBPXjmxrQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=tdexPztk1ZARGj4c5Bhw0U W13nY=; b=WeohZUCRBdQnFPveue2dtoKnBxnrPnVvyBWPdPoGkSoSEIHFnTg7sT JLmXUu20zJwTKrf8eHFiBINSiWtCTy3byO51XlhNT6rcPUGKNO1qnRyzZ2I7f9Qw /Df0Cd6dtodRuQDkIzTSN2sqRF/M3EuCW97rSi72adFgW/Uqiz1bc= X-Sasl-enc: Q9eazwy/pXsOd3qBBCwTqMlTRZlseEp+u3vThugAye2U 1352244891 Original-Received: from fatty (unknown [204.154.109.20]) by mail.messagingengine.com (Postfix) with ESMTPA id A3DBF482647 for ; Tue, 6 Nov 2012 18:34:51 -0500 (EST) Original-Received: from dima by fatty with local (Exim 4.76) (envelope-from ) id 1TVseJ-00089m-3p for bug-gnu-emacs@gnu.org; Tue, 06 Nov 2012 15:33:39 -0800 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Tue, 06 Nov 2012 19:15:58 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66560 Archived-At: --=-=-= Content-Type: text/plain The behavior of appended kills is described in http://www.gnu.org/software/emacs/manual/html_node/emacs/Appending-Kills.html The idea is that when consecutive kills happen, the new text is either appended or prepended to the kill ring entry, depending on the ordering of the mark/point. This works as described for commands such as C-k, M-d, etc. However, the behavior for C-w and M-w is surprising. Suppose my buffer contains 123 with the point at the '1'. I then use point navigation commands, C-M-w and C-w to kill 1 then 2 then 3: C-SPC C-f C-w C-SPC C-f C-M-w C-w C-SPC C-f C-M-w C-w I would expect the kill-ring to then contain "123". Instead, it contains "321". Similarly I get "321" if I do this backwards, i.e. starting with the point at the '3': C-SPC C-f C-w C-SPC C-b C-M-w C-w C-SPC C-b C-M-w C-w C-y If I perform similar actions, but with M-w instead of C-w, I get "123" for the forward case and "321" for the backward case. I would expect "123" in all cases. The current behavior for commands after C-M-w is: C-w: prepend if point>mark; append otherwise M-w: always append new kill I think the behavior should either 1. Match what commands like M-d do; "123" would then result in all 4 of the cases described above or 2. Always append. This is what the manual node at the top of this report says. The 4 cases described above would then produce "123", "321", "123", "321" respectively. I'm attaching a patch that implements behavior 1 and another that implements behavior 2. I have a mild preference for behavior 1, but both are better than what emacs does currently, I think. Historically, the behavior has been "always-append". The current behavior was established in 2006 by http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b7690594 I think the intent of that commit was to implement behavior 1, but I'm not sure. dima --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-C-w-M-w-after-C-M-w-now-pre-ap-pend-intelligently-to.patch Content-Description: Behavior 1 >From bba4cda29284e84b3266b68c46d0dd4e06afa45f Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 6 Nov 2012 15:17:38 -0800 Subject: [PATCH] C-w/M-w after C-M-w now pre/ap-pend intelligently to preserve input ordering --- lisp/simple.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index aed945d..67577e0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3358,7 +3358,7 @@ the text killed this time appends to the text killed last time to make one entry in the kill ring." ;; Pass point first, then mark, because the order matters ;; when calling kill-append. - (interactive (list (point) (mark))) + (interactive (list (mark) (point))) (unless (and beg end) (error "The mark is not set now, so there is no region")) (condition-case nil @@ -3399,7 +3399,7 @@ If `interprogram-cut-function' is non-nil, also save the text for a window system cut and paste. This command's old key binding has been given to `kill-ring-save'." - (interactive "r") + (interactive (list (mark) (point))) (if (eq last-command 'kill-region) (kill-append (filter-buffer-substring beg end) (< end beg)) (kill-new (filter-buffer-substring beg end))) @@ -3417,7 +3417,7 @@ use \\[append-next-kill] before \\[kill-ring-save]. This command is similar to `copy-region-as-kill', except that it gives visual feedback indicating the extent of the region being copied." - (interactive "r") + (interactive (list (mark) (point))) (copy-region-as-kill beg end) ;; This use of called-interactively-p is correct because the code it ;; controls just gives the user visual feedback. -- 1.7.10.4 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-C-w-M-w-after-C-M-w-now-always-append-to-the-prior-k.patch Content-Description: Behavior 2 >From 489081f8e53d39aa4f27584882ed5afa8cc53538 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 6 Nov 2012 15:27:20 -0800 Subject: [PATCH] C-w/M-w after C-M-w now always append to the prior kill-ring element --- lisp/simple.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index aed945d..94a9991 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3358,7 +3358,7 @@ the text killed this time appends to the text killed last time to make one entry in the kill ring." ;; Pass point first, then mark, because the order matters ;; when calling kill-append. - (interactive (list (point) (mark))) + (interactive "r") (unless (and beg end) (error "The mark is not set now, so there is no region")) (condition-case nil -- 1.7.10.4 --=-=-=--