From: Andreas Röhler <andreas.roehler@easy-emacs.de>
Date: Wed, 14 Nov 2018 11:06:52 +0100
(defun foo1 ()
"[Some docu]
(defun other-foo "
(interactive)
;; defining another function inside
(defun foo2 ()
(interactive)
(message "%s" "Foo2")
;; another syntactically correct function just badly indented
(defun foo3 ()
(interactive)
(message "%s" "Foo3"))
)
(message "%s" "Foo1"))
;;;;
Results of evaluation:
(foo1) ==> "Foo1"
(foo2) ==> foo3 ?
(foo3) ==> "Foo3"
Why do you think there's anything wrong here? AFAICT, each evaluation
returns the last sexp evaluated in the respective function. foo1 and
foo3 have a call to 'message' as the last sexp, so they return the
message string, but foo2's last sexp evaluates a defun form, so you
get the result of that, which is the function foo3. IMO, this is
expected and correct behavior.