unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: mflynn@scu.edu
To: help-gnu-emacs@gnu.org
Subject: Re: ELisp Interactive Calls
Date: Fri, 19 Dec 2014 13:22:11 -0800 (PST)	[thread overview]
Message-ID: <edb765bc-070a-4bda-9240-c5add0c7b542@googlegroups.com> (raw)
In-Reply-To: <f222a1d9-a29b-41f3-8d44-c0564e1bacb3@googlegroups.com>

On Friday, December 19, 2014 12:13:36 PM UTC-8, mfl...@scu.edu wrote:
> After all these years I'm trying to teach myself how to write Emacs Lisp programs.
> 
> To call this function:
> 
> (defun my-test-function (arg1)
>   "DOC: Multiply two numbers."
>   (interactive "p")
>   (message "The square of the arg is: %d" (* arg1 arg1))
> )
> 
> 
> I type:
> Ctrl-U 8 Esc-x my-test-function
> 
> and 64 is printed, as I would expect.
> 
> But I'm not sure how to supply two args interactively.
> 
> (defun my-test-function (arg1 arg2)
>   "DOC: Multiply two numbers."
>   (interactive "p p")
>   (message "The product of the args is: %d" (* arg1 arg2))
> )
> 
> How do I call this?  If I type Ctrl-U 8 8 Esc-x my-test-function
> 
> the call fails with a Wrong number of args message.   The second 8 I type just shows up in the scratch buffer.
> 
> Thanks

This is great.   Thank you.


      parent reply	other threads:[~2014-12-19 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 20:13 ELisp Interactive Calls mflynn
2014-12-19 20:38 ` Yuri Khan
2014-12-19 21:22 ` mflynn [this message]

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=edb765bc-070a-4bda-9240-c5add0c7b542@googlegroups.com \
    --to=mflynn@scu.edu \
    --cc=help-gnu-emacs@gnu.org \
    /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).