From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: Re: bug/patch: python.el python-beginning-of-statement Date: Mon, 28 Jun 2004 01:33:42 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088411800 32457 80.91.224.253 (28 Jun 2004 08:36:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 28 Jun 2004 08:36:40 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jun 28 10:36:17 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bercf-0002NP-00 for ; Mon, 28 Jun 2004 10:36:17 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Berce-0000S1-00 for ; Mon, 28 Jun 2004 10:36:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BereF-00076V-EQ for emacs-devel@quimby.gnus.org; Mon, 28 Jun 2004 04:37:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BercM-0006K7-Fh for emacs-devel@gnu.org; Mon, 28 Jun 2004 04:35:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BercH-0006Gr-Nh for emacs-devel@gnu.org; Mon, 28 Jun 2004 04:35:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BercH-0006Bi-Ia for emacs-devel@gnu.org; Mon, 28 Jun 2004 04:35:53 -0400 Original-Received: from [128.32.47.228] (helo=hkn.eecs.berkeley.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1Berad-0002j0-Mp; Mon, 28 Jun 2004 04:34:11 -0400 Original-Received: from quarl by hkn.eecs.berkeley.edu with local id 1BeraA-0003O9-00; Mon, 28 Jun 2004 01:33:42 -0700 Original-To: rms@gnu.org X-Quack-Archive: 1 X-Payment: hashcash 1.2 0:040628:rms@gnu.org:5c6aa6f8ebb83cf0f9ad2999 X-Hashcash: 0:040628:rms@gnu.org:5c6aa6f8ebb83cf0f9ad2999 X-Payment: hashcash 1.2 0:040628:emacs-devel@gnu.org:f7a38cc2d185b620bf6c2d50 X-Hashcash: 0:040628:emacs-devel@gnu.org:f7a38cc2d185b620bf6c2d50 In-Reply-To: (Richard Stallman's message of "Sun, 27 Jun 2004 22:23:26 -0400") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25289 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25289 >>>>> "rms" == Richard Stallman writes: rms> rms> Does this version of the function work right? (Defun rms> python-beginning-of-statement () No, but if you change (throw 'foo) to (throw 'foo nil) it works. (defun python-beginning-of-statement () "Go to start of current statement. Accounts for continuation lines, multi-line strings, and multi-line bracketed expressions." (beginning-of-line) (python-beginning-of-string) (catch 'foo (while (python-continuation-line-p) (beginning-of-line) (if (python-backslash-continuation-line-p) (while (python-backslash-continuation-line-p) (forward-line -1)) (python-beginning-of-string) ;; Skip forward out of nested brackets. (condition-case () ; beware invalid syntax (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) (error (throw 'foo nil)))))) (back-to-indentation)) Is there a rule against using block/return? It seems better to use lexically-scoped blocks than dynamically-scoped blocks. -- Karl 2004-06-28 01:30