unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Karl Chen <quarl@hkn.eecs.berkeley.edu>
Cc: emacs-devel@gnu.org
Subject: Re: bug/patch: python.el python-beginning-of-statement
Date: Mon, 28 Jun 2004 01:33:42 -0700	[thread overview]
Message-ID: <quack.20040628T0133.j5wu1shyjd@hkn.eecs.berkeley.edu> (raw)
In-Reply-To: <E1Belnq-0003NY-7d@fencepost.gnu.org> (Richard Stallman's message of "Sun, 27 Jun 2004 22:23:26 -0400")

>>>>> "rms" == Richard Stallman <rms@gnu.org> 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

      reply	other threads:[~2004-06-28  8:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  9:34 bug/patch: python.el python-beginning-of-statement Karl Chen
2004-06-28  2:23 ` Richard Stallman
2004-06-28  8:33   ` Karl Chen [this message]

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=quack.20040628T0133.j5wu1shyjd@hkn.eecs.berkeley.edu \
    --to=quarl@hkn.eecs.berkeley.edu \
    --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).