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: Richard Stallman
Subject: Re: bug/patch: python.el python-beginning-of-statement
Date: Sun, 27 Jun 2004 22:23:26 -0400

Does this version of the function work right?

(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))))))
  (back-to-indentation))




reply via email to

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