all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
Subject: Re: Elisp:  Simple function to Add Two Numbers
Date: Sun, 27 Aug 2006 21:50:57 -0400	[thread overview]
Message-ID: <barmar-73FB19.21505727082006@comcast.dca.giganews.com> (raw)
In-Reply-To: ihq64gdtz97.fsf@chlr7032.ch.intel.com

In article <ihq64gdtz97.fsf@chlr7032.ch.intel.com>,
 Edward Dodge <user@foo.bar> wrote:

> Pascal Bourguignon <pjb@informatimago.com> writes:
> 
> 
> > The whitespaces don't matter, as long as they're not just after a
> > newline.  The problem is that there are two newlines with three
> > characters specifying a total of four interactive arguments: n, n and r.
> > (r gives two arguments, start and end of region).
> 
> Yes,  this is correct.  And I have managed to keep the function from causing
> an error by rewriting it:
> 
> (defun ekd-average (jabba wabba)
>   "Adds two numbers and returns the difference between"
>   (interactive "nFirstvar: \nnSecondvar: ")
>      (eval ( + jabba wabba)))

You don't need eval.

> 
> Now the only problem is this:  it returns no answer when I run it.  I thought
> lisp functions always returned a value.  I even made it explicit by using the
> "eval" statement,  but still I get no answer in either the minibuffer or
> *Messages*.

Yes, the function returns a value.  But your command never displays the 
value anywhere, and M-x doesn't automatically display the return value 
of functions.  Use (print (+ jabba wabba)) and it will be displayed in 
the echo area.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

  reply	other threads:[~2006-08-28  1:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-27 21:25 Elisp: Simple function to Add Two Numbers Edward Dodge
2006-08-27 21:47 ` Hadron Quark
2006-08-27 21:55   ` Pascal Bourguignon
2006-08-28  1:39     ` Edward Dodge
2006-08-28  1:50       ` Barry Margolin [this message]
2006-08-29  0:18         ` Edward Dodge
2006-08-27 21:55 ` Magnus Henoch
2006-08-27 22:12 ` David Kastrup

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=barmar-73FB19.21505727082006@comcast.dca.giganews.com \
    --to=barmar@alum.mit.edu \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.