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

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

Set (global) function argument from inside function


From: Thorsten Jolitz
Subject: Set (global) function argument from inside function
Date: Sun, 10 Aug 2014 11:24:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi List, 

how can I set (global, not function-local) X from inside `foo' such that
I would see

,----
| #+results:
| : fooY: 7 Y: 7
`----

as the last result?

#+begin_src emacs-lisp
 (defun foo (X)
   (setq X (+ X 5)))
#+end_src

#+results:
: foo

#+begin_src emacs-lisp
 (setq Y 2)
 (message "fooY: %s Y: %s" (foo Y) Y)
#+end_src

#+results:
: fooY: 7 Y: 2


-- 
cheers,
Thorsten




reply via email to

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