Mercurial > emacs
comparison lisp/progmodes/python.el @ 80881:4882ec1204fb
(python-end-of-block): Revert last change.
(python-end-of-statement): Make sure we move *forward*.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 09 May 2007 16:53:13 +0000 |
parents | ca9519bf5703 |
children | e04539d0ccf5 |
comparison
equal
deleted
inserted
replaced
80880:dba96e4a8a94 | 80881:4882ec1204fb |
---|---|
881 (cond ((eq 'comment (syntax-ppss-context s)) | 881 (cond ((eq 'comment (syntax-ppss-context s)) |
882 (setq comment t) | 882 (setq comment t) |
883 nil) | 883 nil) |
884 ((eq 'string (syntax-ppss-context s)) | 884 ((eq 'string (syntax-ppss-context s)) |
885 ;; Go to start of string and skip it. | 885 ;; Go to start of string and skip it. |
886 (goto-char (nth 8 s)) | 886 (let ((pos (point))) |
887 (condition-case () ; beware invalid syntax | 887 (goto-char (nth 8 s)) |
888 (progn (forward-sexp) t) | 888 (condition-case () ; beware invalid syntax |
889 (error (end-of-line)))) | 889 (progn (forward-sexp) t) |
890 ;; If there's a mismatched string, make sure | |
891 ;; we still overall move *forward*. | |
892 (error (goto-char pos) (end-of-line))))) | |
890 ((python-skip-out t s)))) | 893 ((python-skip-out t s)))) |
891 (end-of-line)) | 894 (end-of-line)) |
892 (unless comment | 895 (unless comment |
893 (eq ?\\ (char-before)))) ; Line continued? | 896 (eq ?\\ (char-before)))) ; Line continued? |
894 (end-of-line 2)) ; Try next line. | 897 (end-of-line 2)) ; Try next line. |
979 (while (and (> arg 0) | 982 (while (and (> arg 0) |
980 (let* ((point (point)) | 983 (let* ((point (point)) |
981 (_ (if (python-comment-line-p) | 984 (_ (if (python-comment-line-p) |
982 (python-skip-comments/blanks t))) | 985 (python-skip-comments/blanks t))) |
983 (ci (current-indentation)) | 986 (ci (current-indentation)) |
984 (open (python-open-block-statement-p)) | 987 (open (python-open-block-statement-p))) |
985 opoint) | |
986 (if (and (zerop ci) (not open)) | 988 (if (and (zerop ci) (not open)) |
987 (not (goto-char point)) | 989 (not (goto-char point)) |
988 (catch 'done | 990 (catch 'done |
989 (setq opoint (point)) | 991 (while (zerop (python-next-statement)) |
990 (while (and (zerop (python-next-statement)) | |
991 (not (= opoint (point)))) | |
992 (setq opoint (point)) | |
993 (when (or (and open (<= (current-indentation) ci)) | 992 (when (or (and open (<= (current-indentation) ci)) |
994 (< (current-indentation) ci)) | 993 (< (current-indentation) ci)) |
995 (python-skip-comments/blanks t) | 994 (python-skip-comments/blanks t) |
996 (beginning-of-line 2) | 995 (beginning-of-line 2) |
997 (throw 'done t))))))) | 996 (throw 'done t))))))) |