unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Define interactive function with arguments
Date: Fri, 09 Oct 2020 01:47:57 +0200	[thread overview]
Message-ID: <87v9fkth3m.fsf@ebih.ebihd> (raw)
In-Reply-To: trinity-95b0ad78-9b55-44b1-bea4-a7144db0e79e-1602198901840@3c-app-mailcom-bs14

Christopher Dimech wrote:

> I want to call a function that takes a numeric
> argument to I can shift paragraphs.
>
> ( defun Transpose-Paragraphs-Arg (arg)
>     "Transfer paragraph backward"
>     (interactive)
>     (transpose-paragraphs arg)
> )
>
> I have been using "M-x Transpose-Paragraphs-Arg"
>
> But then, how does one pass the value of the
> argument to the function.

C-u X M-x transpose-paragraphs RET

where X marks the spot!

Use without an explicit number also works,

  just C-u - 4
  then C-u C-u - 16
  and so on

Also negative values are possible, e.g.

  C-u -1 M-x transpose-paragraphs RET

Also works with shortcuts.

See

  C-h f universal-argument RET

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




  parent reply	other threads:[~2020-10-08 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 23:15 Define interactive function with arguments Christopher Dimech
2020-10-08 23:41 ` Stefan Monnier
2020-10-08 23:47 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2020-10-09  6:38   ` Christopher Dimech
2020-10-09  7:18     ` Joost Kremers
2020-10-09  8:57       ` Christopher Dimech
2020-10-09  9:22         ` Joost Kremers
2020-10-09  9:52           ` Christopher Dimech
2020-10-09 14:03             ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-09 14:01         ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-09 14:24           ` 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=87v9fkth3m.fsf@ebih.ebihd \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /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).