unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: 33375@debbugs.gnu.org
Subject: bug#33375: 27.0.50; Nested function definitions
Date: Wed, 14 Nov 2018 17:40:12 +0200	[thread overview]
Message-ID: <835zwz8y77.fsf@gnu.org> (raw)
In-Reply-To: <c055465a-5033-3e5c-3b75-39931a30fb8d@easy-emacs.de> (message from Andreas Röhler on Wed, 14 Nov 2018 11:06:52 +0100)

> 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.





  parent reply	other threads:[~2018-11-14 15:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14  9:39 bug#33375: 27.0.50; Nested function definitions Andreas Röhler
2018-11-14 10:06 ` Andreas Röhler
2018-11-14 11:46   ` Andreas Röhler
2018-11-14 15:40   ` Eli Zaretskii [this message]
2018-11-15  7:01     ` Andreas Röhler
2018-11-15 12:36       ` Noam Postavsky
2018-11-15 15:04         ` Andreas Röhler
2018-11-15 15:05           ` Eli Zaretskii
2018-11-15 15:14             ` Andreas Röhler
2018-11-15 15:21               ` Andreas Röhler

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=835zwz8y77.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33375@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    /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 public inbox

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

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).