comparison lisp/progmodes/python.el @ 90386:2ecafc6d5db7

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-58 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 239-258) - Update from CVS - (Ffield_beginning, find_field): Undo change of 2006-04-23. - Rcirc patch from Ryan Yeske - Merge from gnus--rel--5.10 - Clean up lisp/gnus/ChangeLog a bit * gnus--rel--5.10 (patch 91-98) - Merge from emacs--devo--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 02 May 2006 05:51:52 +0000
parents 72dea2ff0142 7a59f2600206
children 6823a91487f2
comparison
equal deleted inserted replaced
90385:72dea2ff0142 90386:2ecafc6d5db7
290 "Return non-nil if current line continues a previous one. 290 "Return non-nil if current line continues a previous one.
291 The criteria are that the previous line ends in a backslash outside 291 The criteria are that the previous line ends in a backslash outside
292 comments and strings, or that the bracket/paren nesting depth is nonzero." 292 comments and strings, or that the bracket/paren nesting depth is nonzero."
293 (or (and (eq ?\\ (char-before (line-end-position 0))) 293 (or (and (eq ?\\ (char-before (line-end-position 0)))
294 (not (syntax-ppss-context (syntax-ppss)))) 294 (not (syntax-ppss-context (syntax-ppss))))
295 (/= 0 (syntax-ppss-depth 295 (< 0 (syntax-ppss-depth
296 (save-excursion ; syntax-ppss with arg changes point 296 (save-excursion ; syntax-ppss with arg changes point
297 (syntax-ppss (line-beginning-position))))))) 297 (syntax-ppss (line-beginning-position)))))))
298 298
299 (defun python-comment-line-p () 299 (defun python-comment-line-p ()
300 "Return non-nil iff current line has only a comment." 300 "Return non-nil iff current line has only a comment."
301 (save-excursion 301 (save-excursion
302 (end-of-line) 302 (end-of-line)
717 (while (python-backslash-continuation-line-p) 717 (while (python-backslash-continuation-line-p)
718 (forward-line -1)) 718 (forward-line -1))
719 (python-beginning-of-string) 719 (python-beginning-of-string)
720 ;; Skip forward out of nested brackets. 720 ;; Skip forward out of nested brackets.
721 (condition-case () ; beware invalid syntax 721 (condition-case () ; beware invalid syntax
722 (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) 722 (let ((depth (syntax-ppss-depth (syntax-ppss))))
723 ;; Beware negative depths.
724 (if (> depth 0) (backward-up-list depth))
725 t)
723 (error (throw 'foo nil)))))) 726 (error (throw 'foo nil))))))
724 (back-to-indentation)) 727 (back-to-indentation))
725 728
726 (defun python-end-of-statement () 729 (defun python-end-of-statement ()
727 "Go to the end of the current statement and return point. 730 "Go to the end of the current statement and return point.
1753 nil) 1756 nil)
1754 hs-special-modes-alist))) 1757 hs-special-modes-alist)))
1755 (if (featurep 'hippie-exp) 1758 (if (featurep 'hippie-exp)
1756 (set (make-local-variable 'hippie-expand-try-functions-list) 1759 (set (make-local-variable 'hippie-expand-try-functions-list)
1757 (cons 'python-try-complete hippie-expand-try-functions-list))) 1760 (cons 'python-try-complete hippie-expand-try-functions-list)))
1758 (unless font-lock-mode (font-lock-mode 1))
1759 (when python-guess-indent (python-guess-indent)) 1761 (when python-guess-indent (python-guess-indent))
1760 (set (make-local-variable 'python-command) python-python-command) 1762 (set (make-local-variable 'python-command) python-python-command)
1761 (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode 1763 (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode
1762 (let ((python-mode-running t)) 1764 (let ((python-mode-running t))
1763 (python-maybe-jython)))) 1765 (python-maybe-jython))))