0

Transpose words (M-t) always swaps the word with the next.

How can this be performed with the previous word?

3

Use a prefix argument, as the documentation indicates:

(transpose-words ARG)

Interchange words around point, leaving point at end of them. With prefix arg ARG, effect is to take word before or around point and drag it forward past ARG other words (backward if ARG negative). If ARG is zero, the words around or after point and around or after mark are interchanged.

C-u -1 M-t works for your specific case.

3
  • So when calling from a single key shortcut, I would need to use a function to set this argument? – ideasman42 Nov 27 '19 at 15:33
  • 2
    M--M-t is shorter – rpluim Nov 27 '19 at 15:37
  • 1
    If you're calling (transpose-words) in your key binding, change it to call (transpose-words -1) instead. – Steve Vinoski Nov 27 '19 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.