unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: charles@aurox.ch (Charles A. Roelli)
Cc: 30343@debbugs.gnu.org
Subject: bug#30343: make transpose-regions interactive
Date: Sat, 10 Feb 2018 12:58:23 +0200	[thread overview]
Message-ID: <83h8qp2jsg.fsf@gnu.org> (raw)
In-Reply-To: <m2r2q1ay0m.fsf@aurox.ch> (charles@aurox.ch)

> 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.





  reply	other threads:[~2018-02-10 10:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-04  9:37 bug#30343: make transpose-regions interactive Charles A. Roelli
2018-02-04  9:45 ` Charles A. Roelli
2018-02-10 10:58   ` Eli Zaretskii [this message]
2018-03-07 20:56     ` Charles A. Roelli
2018-03-10 12:02       ` Eli Zaretskii
2018-03-10 14:22         ` Eli Zaretskii
2018-03-11 11:11         ` Charles A. Roelli

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=83h8qp2jsg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30343@debbugs.gnu.org \
    --cc=charles@aurox.ch \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).