From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#30343: make transpose-regions interactive Date: Sat, 10 Feb 2018 12:58:23 +0200 Message-ID: <83h8qp2jsg.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1518260262 15474 195.159.176.226 (10 Feb 2018 10:57:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Feb 2018 10:57:42 +0000 (UTC) Cc: 30343@debbugs.gnu.org To: charles@aurox.ch (Charles A. Roelli) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 10 11:57:38 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekSqD-0001yH-L4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Feb 2018 11:57:09 +0100 Original-Received: from localhost ([::1]:53888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekSsE-0003dl-Uk for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Feb 2018 05:59:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekSs3-0003bQ-V9 for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 05:59:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekSs2-0005Ei-Mc for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 05:59:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ekSs2-0005E9-HI for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 05:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ekSs2-0003SL-9K for bug-gnu-emacs@gnu.org; Sat, 10 Feb 2018 05:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2018 10:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30343 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 30343-submit@debbugs.gnu.org id=B30343.151826033413270 (code B ref 30343); Sat, 10 Feb 2018 10:59:02 +0000 Original-Received: (at 30343) by debbugs.gnu.org; 10 Feb 2018 10:58:54 +0000 Original-Received: from localhost ([127.0.0.1]:36107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekSrt-0003Ry-M9 for submit@debbugs.gnu.org; Sat, 10 Feb 2018 05:58:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekSrs-0003Rl-IT for 30343@debbugs.gnu.org; Sat, 10 Feb 2018 05:58:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ekSrj-0004m1-1s for 30343@debbugs.gnu.org; Sat, 10 Feb 2018 05:58:47 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ekSri-0004lr-Tm; Sat, 10 Feb 2018 05:58:42 -0500 Original-Received: from [176.228.60.248] (port=3480 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ekSrg-0003af-PS; Sat, 10 Feb 2018 05:58:41 -0500 In-reply-to: (charles@aurox.ch) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:143084 Archived-At: > Date: Sun, 04 Feb 2018 10:45:45 +0100 > From: charles@aurox.ch (Charles A. Roelli) > > What follows is a patch to make transpose-regions interactive. > > I also noticed that transpose-sentences/paragraphs are not documented, > so I'll add those in another commit. Thanks. > @@ -183,7 +185,7 @@ Transpose > (@code{transpose-lines}) exchanges lines. They work like @kbd{M-t} > except as regards what units of text they transpose. > > - A numeric argument to a transpose command serves as a repeat count: it > + A numeric argument to most transpose commands serves as a repeat count: it > [...] > +@findex transpose-regions > + @kbd{M-x transpose-regions} transposes the text between point and > +mark with the text between the first two elements of the mark ring. I would say "... with the text between the last two marks pushed to the mark ring." I would also add a cross-reference here to where set-mark-command is described. > +Unlike the other transpose commands, it does not behave differently > +when given a prefix argument. This command is best used for > +transposing multiple units of text (words, sentences, paragraphs) in > +one go. Would it make sense to make the new command interpret the prefix argument the same way as the other transpose commands? E.g., why not use pairs of marks further back in the mark ring? > -DEFUN ("transpose-regions", Ftranspose_regions, Stranspose_regions, 4, 5, 0, > +DEFUN ("transpose-regions", Ftranspose_regions, Stranspose_regions, 4, 5, > + "(if (< (length mark-ring) 2)\ > + (error \"Mark ring must contain at least two elements\")\ > + (list (point) (mark) (car mark-ring) (cadr mark-ring)))", The error message could be made more clear, e.g. by saying that the other region should be marked first. Talking about the size of the mark ring is too technical, IMO. > +Interactively, STARTR1 and ENDR1 are point and mark. STARTR2 and > +ENDR2 are the first and second markers in the mark ring. > +LEAVE-MARKERS is nil. */) "First and second" is ambiguous, since you don't tell from which end they are counted. Also, these 3 sentences all talk about interactive invocation, so they should probably be a single sentence separated with semi-colons instead.