[Top][All Lists]

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

Re: Transposing words over middle words

From: Tomas Nordin
Subject: Re: Transposing words over middle words
Date: Tue, 21 Nov 2017 18:21:42 +0100

> Than again, maybe M-t should work like `C-0 M-t` whenever the region
> is active so you don't even need the C-u at all.

Here is an advice to make that happen, respecting possible prefixes.

(defun tn-transpose-dwim-advice (transpose-subr &rest args)
  (if (and (use-region-p) (= (cadr args) 1))
      ;;                      MOVER  dwim  SPECIAL
      (apply transpose-subr (car args) 0 (cddr args))
    (apply transpose-subr args)))

(advice-add 'transpose-subr :around #'tn-transpose-dwim-advice)

;;; remove the hack with this:
;; (advice-remove 'transpose-subr #'tn-transpose-dwim-advice)

reply via email to

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