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

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

Re: Define interactive function with arguments


From: Emanuel Berg
Subject: Re: Define interactive function with arguments
Date: Fri, 09 Oct 2020 01:47:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

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




reply via email to

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