From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Keybinding Default Command and Execution with Argument Date: Thu, 5 Nov 2020 16:58:11 +0100 Message-ID: <20201105155811.GB24492@tuxteam.de> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3798"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 05 16:59:42 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kahfn-0000km-OV for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 05 Nov 2020 16:59:39 +0100 Original-Received: from localhost ([::1]:33448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kahfm-0006c8-Q6 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 05 Nov 2020 10:59:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaheb-0005rE-VC for help-gnu-emacs@gnu.org; Thu, 05 Nov 2020 10:58:25 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:53745) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1kaheZ-0002UA-Gx for help-gnu-emacs@gnu.org; Thu, 05 Nov 2020 10:58:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=BGa+Jr73oPQ63cU8xBNlrX8tl7U33p6KXUNTbeAqWwE=; b=OoRgLXCzV6eyPQK5PRpUP0vePrIYYXGNG2d9TGHMBk4hSh5N2EPBrib0+Egqsih9CGeS6Htwv/rbIRAycWzgB0y8eDn2mCuuYon+Em+T2A1sapTFn2EntFUBjne1plUH+9809u7iUj0RCLD7hNbBh4FqbEw49NrZ+hbqh+xj/bJ+v11cAwNoO4cItQKRk84FMooqJu3q1jj0/hu5gnxsEepfhJH3NUfi/9rf+IO/mrDyCDIGIdBFWUAZXEyG7cmn6PfWGxqvfRYouhSIi4hIOlDVPVkWTeGa9lxEN5DJrV+16CDPeepQQd99KA3e3xwuW4RhNobnhij9JZf9gFRtvw==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1kaheN-0006XA-D3 for help-gnu-emacs@gnu.org; Thu, 05 Nov 2020 16:58:11 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/05 10:45:48 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:125020 Archived-At: --gatW/ieO32f1wygP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 characte= rs. > It behaves a differently than transpose-chars, because the cursor point s= tays > on the same character, rather than moving to the cursor next to the swapp= ed > character to the right. >=20 > When using transpose-chars. one can use transpose-chars without any argum= ent, > taking the default of one. >=20 > M-x transpose-chars >=20 > Alternatively, one can pass an argument (e.g. 3) as follows >=20 > C-u 3 M-x transpose-chars >=20 > 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 defau= lting > 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 =E2=80=98simple.el=E2=80=99. 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 --gatW/ieO32f1wygP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl+kIRMACgkQBcgs9XrR2kaNlgCfUTenlr6XwgmaaE/Ou69t3kR7 xDYAmwW8IIzY4LfKR8QSmB9reXS0F2FV =4A/a -----END PGP SIGNATURE----- --gatW/ieO32f1wygP--