From: Christopher Dimech <dimech@gmx.com>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: Keybinding Default Command and Execution with Argument
Date: Thu, 5 Nov 2020 17:19:16 +0100 [thread overview]
Message-ID: <trinity-fdf23a39-252b-43a7-8667-ce33cb155be1-1604593156722@3c-app-mailcom-bs14> (raw)
In-Reply-To: <20201105155811.GB24492@tuxteam.de>
My Emacs is insane then as it does not give me the link to simple.el
> Sent: Thursday, November 05, 2020 at 4:58 PM
> From: tomas@tuxteam.de
> To: help-gnu-emacs@gnu.org
> Subject: Re: Keybinding Default Command and Execution with Argument
>
> On Thu, Nov 05, 2020 at 04:41:11PM +0100, Christopher Dimech wrote:
> > 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?
>
> Ask `transpose-chars' itself :)
>
> I.e. do
>
> C-h f transpose-chars
>
> You'll get a small help buffer explaining transpose-chars. Basically the
> function's docstring, and then something.
>
> Part of this something is the function's location, like so:
>
> "transpose-chars is an interactive compiled Lisp function in
> in ‘simple.el’.
>
> It is bound to C-t.
>
> [more stuff]"
>
> The simple.el is highlighted as a link. It is a link. If your
> Emacs installation is sane, you can put point at this link
> (alternatively you click on it), and you get to transpose-char's
> definition, in simple.el. There you see:
>
> (defun transpose-chars (arg)
> "Interchange characters around point, moving forward one character.
> With prefix arg ARG, effect is to take character before point
> and drag it forward past ARG other characters (backward if ARG negative).
> If no argument and at end of line, the previous two chars are exchanged."
> (interactive "*P")
> (when (and (null arg) (eolp) (not (bobp))
> ... ) ...) ...)
>
> So they are using (interactive "P") for that. You can look up what that
> means in `interactive's documentation. The asterisk is there to ensure
> that the buffer is writable.
>
> Emacs teaches you the tricks of the Grandmasters ;-)
>
> Cheers
> - t
>
next prev parent reply other threads:[~2020-11-05 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-11-05 16:24 ` tomas
2020-11-05 16:29 ` Christopher Dimech
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-fdf23a39-252b-43a7-8667-ce33cb155be1-1604593156722@3c-app-mailcom-bs14 \
--to=dimech@gmx.com \
--cc=help-gnu-emacs@gnu.org \
--cc=tomas@tuxteam.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).