From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.bugs Subject: bug#11974: 24.1.50; python-nav-forward-sexp-function doesn't skip over strings Date: Wed, 18 Jul 2012 14:29:39 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1342614679 1232 80.91.229.3 (18 Jul 2012 12:31:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2012 12:31:19 +0000 (UTC) To: 11974@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 18 14:31:17 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SrTPK-0008II-JP for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 14:31:10 +0200 Original-Received: from localhost ([::1]:46188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTPJ-0006eB-U3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Jul 2012 08:31:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTPD-0006dx-Mr for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:31:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrTP7-0006W1-4Y for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:31:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTP7-0006Vt-0o for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:30:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SrTV0-0008Te-CV for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Andrus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jul 2012 12:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11974 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134261496432521 (code B ref -1); Wed, 18 Jul 2012 12:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2012 12:36:04 +0000 Original-Received: from localhost ([127.0.0.1]:47691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrTU3-0008SU-S8 for submit@debbugs.gnu.org; Wed, 18 Jul 2012 08:36:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51942) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrTU1-0008SJ-RB for submit@debbugs.gnu.org; Wed, 18 Jul 2012 08:36:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrTO6-00064X-PH for submit@debbugs.gnu.org; Wed, 18 Jul 2012 08:29:55 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:54442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTO6-00064N-Ln for submit@debbugs.gnu.org; Wed, 18 Jul 2012 08:29:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTO0-0005qU-TT for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:29:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrTNu-000624-IN for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:29:48 -0400 Original-Received: from mail-bk0-f41.google.com ([209.85.214.41]:40059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrTNu-00061R-BX for bug-gnu-emacs@gnu.org; Wed, 18 Jul 2012 08:29:42 -0400 Original-Received: by bkcjc3 with SMTP id jc3so1324704bkc.0 for ; Wed, 18 Jul 2012 05:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; bh=jRXB7jw2os9lAI4KjRfw7oGZXoGURgmsiHeU3QTNQPM=; b=oSuj/irxgfY8Dk29wsHKdZQjnr5N1zp9+toW4uVN9AVescpDS0wrX6vQMddYkJrs2x kf+sj8O3G0/aJs72Qoi1wjkSPyKB/qodWB4Daj82LRZwzqR3r7unAS9R9aZW6Dhc9JWI qtYzwl/4JdchSUZNixeDs9gaHAIezTBoY2su5PuQsqJQXUQHVvwGuchcXYV2idaB6prV lpmCvbJkAOupeOtl36SKDpHot4+d7A1bQmzIMtEOMsqtxR1w92JdB0binh/le2wOM8GX I5Wxz1HP2BkPkGfpRB0WjX4jwsIcuzU4Smi3JzTF8Vz4p+M6YjnRyTyUnvnyaYnG9jJB b/jw== Original-Received: by 10.204.152.216 with SMTP id h24mr1446321bkw.42.1342614580874; Wed, 18 Jul 2012 05:29:40 -0700 (PDT) Original-Received: from [172.16.52.145] ([193.225.200.92]) by mx.google.com with ESMTPS id g6sm11763629bkg.2.2012.07.18.05.29.40 (version=SSLv3 cipher=OTHER); Wed, 18 Jul 2012 05:29:40 -0700 (PDT) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62095 Archived-At: Actually, the new function `python-nav-forward-sexp-function' doesn't do what I expect at all. I use forward-sexp, up-list and friends a lot, so perhaps I'm not typical. I do think sexp-like movement for python would be AWESOME! Let me show some use cases where the current functionality is broken for me, and then attempt to articulate what I would like/expect. I shall always assume that forward-sexp has a positive argument, and the obvious statements hold for negative arguments. In sage-mode we narrow to a docstring by doing the equivalent of (let* ((bos (python-info-ppss-context 'string))) (goto-char bos) (forward-sexp 1) (narrow-to-region bos (point))) This is broken now since forward-sexp goes to the end of the block, far past the end of the string (or not moving at all). If you have any undindented code at the end of your buffer, then forward-sexp (and up-list) will refuse to move past it e.g. def main(): 2+3 # I get stuck here print main() What I would expect form a "perfect" python forward-sexp is to skip over a block if and only if you are at the very beginning of the block. Otherwise is should skip over a statement if and only if you are at the beginning of a statement. Otherwise is should act exactly as an unmodified forward-sexp would, skipping over words, parenthesized expressions, and strings. I guess this is because I think of python as having a set of parens around a block as well as parens around each statement in addition to all parens and strings that are currently there. I don't guarantee that this would be a good experience, but I think it would. Hopefully up-list would then move to the end of the block etc. I'm not sure how to deal with down-list. Perhaps going to the first statement if it's at the beginning of a block and into a parenthesized expression otherwise? -Ivan