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

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

Keybinding Default Command and Execution with Argument


From: Christopher Dimech
Subject: Keybinding Default Command and Execution with Argument
Date: Thu, 5 Nov 2020 16:41:11 +0100

I made a simple defun to move the current character over n other characters.
It behaves a differently than transpose-chars, because the cursor point stays
on the same character, rather than moving to the cursor next to the swapped
character to the right.

When using transpose-chars. one can use transpose-chars without any argument,
taking the default of one.

  M-x transpose-chars

Alternatively, one can pass an argument (e.g. 3) as follows

  C-u 3 M-x transpose-chars

Currently, I can only use Skip-Over-Chars with argument.  Is there a way to
use the function Skip-Over-Chars without requiring an argument, but defaulting
the argument to one as what can be done with transpose-chars?


(defun Skip-Over-Chars (n)
   "Skip-Over-Chars transfers character over 'n' other
characters, forward and backward."
   (interactive "N Number of skips: ")
   (forward-char)
   (transpose-chars n)
   (backward-char)
)




reply via email to

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