emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug/patch: python.el python-beginning-of-statement


From: Karl Chen
Subject: Re: bug/patch: python.el python-beginning-of-statement
Date: Mon, 28 Jun 2004 01:33:42 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

>>>>> "rms" == Richard Stallman <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]