all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why does this code sometimes work?
@ 2006-02-17 11:14 jacksneckhurts
  2006-02-17 11:31 ` Robert D. Crawford
  0 siblings, 1 reply; 2+ messages in thread
From: jacksneckhurts @ 2006-02-17 11:14 UTC (permalink / raw)


I pulled the following code from a tutorial:

;; begin
(defun multiply-by-seven (number)
  "Multiply NUMBER by seven."
  (* 7 number))

(multiply-by-seven 3)
;; end

I put it in emacs as is, and sometimes it runs, and most of the time it
errors out... I run the code with "ctrl-x ctrl-e" while the cursor is
to the right of "3)". What am I doing wrong? Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why does this code sometimes work?
  2006-02-17 11:14 Why does this code sometimes work? jacksneckhurts
@ 2006-02-17 11:31 ` Robert D. Crawford
  0 siblings, 0 replies; 2+ messages in thread
From: Robert D. Crawford @ 2006-02-17 11:31 UTC (permalink / raw)


jacksneckhurts@yahoo.com writes:

> I pulled the following code from a tutorial:
>
> ;; begin (defun multiply-by-seven (number)
>   "Multiply NUMBER by seven."
>   (* 7 number))
>
> (multiply-by-seven 3) ;; end
>
> I put it in emacs as is, and sometimes it runs, and most of the time
> it errors out... 

What does the backtrace tell you.  If you are getting a lisp error, you
should be getting a backgtrace.

> I run the code with "ctrl-x ctrl-e" while the cursor is to the right
> of "3)". What am I doing wrong? Thanks!

You have to be more specific about where the cursor is.  C-x C-e will
eval the last sexp before point.  Point is actually _between the
character that the cursor is on and the character right before it.  So
if the cursor is resting on the paren after the three in your
expression, then it will eval the 3 and since numbers eval as
themselves, that will be returned.  If, however you have the cursor
resting on the space just after the paren, it should eval properly.

rdc

position of the cursor 

-- 
<========================================================================>
Robert D. Crawford                                      rdc1x@comcast.net

There was a phone call for you.
<========================================================================>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-17 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-17 11:14 Why does this code sometimes work? jacksneckhurts
2006-02-17 11:31 ` Robert D. Crawford

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.