unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Python interactive navigation around nested functions
Date: Sun, 19 Jun 2016 22:43:00 -0400	[thread overview]
Message-ID: <jwva8ig4mf3.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 87lh21eq5c.fsf@secretsauce.net

>         def wwrap(f):
>             print 'Inside wwrap()'
>             def wrapped_f(*args):
>                 print 'Inside wrapped_f()'
>                 print 'Decorator arguments:', arg1, arg2, arg3
>                 f(*args)
>                 print 'After f(*args)'
>             return wrapped_f
>         return wwrap

> The point is on "return wrapped_f".  The user then hits C-M-a to navigate
> to the beginning of the current function.  The point is unambiguously
> inside wwrap() and not inside wrapped_f(), so I claim it should end up
> at the "def wwrap(f)" line.  However the current behavior (and that test
> suite check) say it should end up on "def "wrapped_f()".

[ Note: the below is the view from the generic side of Emacs, because
  I don't know much about Python in general and python-mode
  in particular.  ]

Traditionally (IMO), C-M-a goes to the nearest beginning of defun at the
same AST level or higher.  So from "return wrapped_f", it seems reasonable
to jump to "def wrapped_f(*args):".

If you want to jump to the beginning of the enclosing defun, I think we
need another function, which currently doesn't exist in the "generic"
part of Emacs.  If C-M-a always jumped to the beginning of the enclosing
defun, then it would always jump to BOB when called from outside
a function, and that's clearly not how it behaves usually.


        Stefan




  reply	other threads:[~2016-06-20  2:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19  4:52 Python interactive navigation around nested functions Dima Kogan
2016-06-20  2:43 ` Stefan Monnier [this message]
2016-06-20  7:14   ` Andreas Röhler
2016-06-20  7:34     ` Stefan Monnier
2016-06-20  8:28       ` Andreas Röhler
2016-06-20 13:57         ` Clément Pit--Claudel
2016-06-20 16:23           ` Andreas Röhler
2016-06-21  5:45   ` Dima Kogan
2016-06-21  6:05     ` Dima Kogan
2016-06-21  6:21       ` Stefan Monnier
2016-06-24 22:10         ` Dima Kogan
2016-06-24 23:23           ` Clément Pit--Claudel
2016-06-26 19:29             ` Andreas Röhler
2016-06-27  0:39               ` Clément Pit--Claudel
2016-06-27  6:02                 ` Andreas Röhler
2016-06-25  0:18           ` Stefan Monnier
2016-06-26 19:37             ` Andreas Röhler
2016-06-21  6:32       ` Andreas Röhler
2016-06-21  6:26     ` 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=jwva8ig4mf3.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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).