comparison lisp/progmodes/python.el @ 56324:e6bf7376c962

(python-beginning-of-statement): Exit the loop if backward-up-list gets error.
author Richard M. Stallman <rms@gnu.org>
date Fri, 02 Jul 2004 23:49:50 +0000
parents 0cecb3d4d566
children 9fc67253aa56 6f6e9fe4658b
comparison
equal deleted inserted replaced
56323:a712704c769c 56324:e6bf7376c962
708 "Go to start of current statement. 708 "Go to start of current statement.
709 Accounts for continuation lines, multi-line strings, and multi-line bracketed 709 Accounts for continuation lines, multi-line strings, and multi-line bracketed
710 expressions." 710 expressions."
711 (beginning-of-line) 711 (beginning-of-line)
712 (python-beginning-of-string) 712 (python-beginning-of-string)
713 (while (python-continuation-line-p) 713 (catch 'foo
714 (beginning-of-line) 714 (while (python-continuation-line-p)
715 (if (python-backslash-continuation-line-p) 715 (beginning-of-line)
716 (while (python-backslash-continuation-line-p) 716 (if (python-backslash-continuation-line-p)
717 (forward-line -1)) 717 (while (python-backslash-continuation-line-p)
718 (python-beginning-of-string) 718 (forward-line -1))
719 ;; Skip forward out of nested brackets. 719 (python-beginning-of-string)
720 (condition-case () ; beware invalid syntax 720 ;; Skip forward out of nested brackets.
721 (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) 721 (condition-case () ; beware invalid syntax
722 (error (end-of-line))))) 722 (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t)
723 (error (throw 'foo nil))))))
723 (back-to-indentation)) 724 (back-to-indentation))
724 725
725 (defun python-end-of-statement () 726 (defun python-end-of-statement ()
726 "Go to the end of the current statement and return point. 727 "Go to the end of the current statement and return point.
727 Usually this is the start of the next line, but if this is a 728 Usually this is the start of the next line, but if this is a