help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transposing words over middle words


From: Emanuel Berg
Subject: Re: Transposing words over middle words
Date: Thu, 16 Nov 2017 22:15:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski wrote:

>> A numeric argument of zero is assigned
>> a special meaning (because otherwise
>> a command with a repeat count of zero would
>> do nothing): to transpose the character
>> (word, expression, line) ending after point
>> with the one ending after the mark.
>>
>> (info "(emacs) Transpose")
>
> I had no idea! How cool is that?
> Thanks a lot!!!

Cool indeed, but the mark business makes it as
complicated anyway compared with transposing
two times:

(defun transpose-over-word ()
  (interactive)
  (transpose-subr #'forward-word  2)
  (backward-word 1)
  (transpose-subr #'forward-word -1) )

(defun transpose-over-word-2 ()
  (interactive)
  (backward-char 1)
  (push-mark)
  (forward-word 3)
  (backward-char 1)
  (transpose-words 0)
  (forward-word 1) )

;; Jack and Jill
;;     ^
;;   point here at invocation

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]