unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Keybinding Default Command and Execution with Argument
@ 2020-11-05 15:41 Christopher Dimech
  2020-11-05 15:58 ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Dimech @ 2020-11-05 15:41 UTC (permalink / raw)
  To: Help Gnu Emacs

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-05 16:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-05 15:41 Keybinding Default Command and Execution with Argument Christopher Dimech
2020-11-05 15:58 ` tomas
2020-11-05 16:17   ` Drew Adams
2020-11-05 16:19   ` Christopher Dimech
2020-11-05 16:24     ` tomas
2020-11-05 16:29       ` Christopher Dimech

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