comparison lisp/progmodes/python.el @ 90780:ec58e5c426ef

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 653-661) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 203-206) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-180
author Miles Bader <miles@gnu.org>
date Sun, 04 Mar 2007 06:19:40 +0000
parents 95d0cdf160ea 985cc73beb79
children 91bf6e05918b
comparison
equal deleted inserted replaced
90779:6ea6d3d1508d 90780:ec58e5c426ef
161 ;; Consider property for initial char, accounting for prefixes. 161 ;; Consider property for initial char, accounting for prefixes.
162 ((or (and (= n 2) ; leading quote (not prefix) 162 ((or (and (= n 2) ; leading quote (not prefix)
163 (= (match-beginning 1) (match-end 1))) ; prefix is null 163 (= (match-beginning 1) (match-end 1))) ; prefix is null
164 (and (= n 1) ; prefix 164 (and (= n 1) ; prefix
165 (/= (match-beginning 1) (match-end 1)))) ; non-empty 165 (/= (match-beginning 1) (match-end 1)))) ; non-empty
166 (unless (eq 'string (syntax-ppss-context (syntax-ppss))) 166 (unless (nth 3 (syntax-ppss))
167 (eval-when-compile (string-to-syntax "|")))) 167 (eval-when-compile (string-to-syntax "|"))))
168 ;; Otherwise (we're in a non-matching string) the property is 168 ;; Otherwise (we're in a non-matching string) the property is
169 ;; nil, which is OK. 169 ;; nil, which is OK.
170 ))) 170 )))
171 171
1741 (end-of-line) 1741 (end-of-line)
1742 (let* ((syntax (syntax-ppss)) 1742 (let* ((syntax (syntax-ppss))
1743 (orig (point)) 1743 (orig (point))
1744 (start (nth 8 syntax)) 1744 (start (nth 8 syntax))
1745 end) 1745 end)
1746 (cond ((eq t (nth 3 syntax)) ; in fenced string 1746 (cond ((eq t (nth 3 syntax)) ; in fenced string
1747 (goto-char (nth 8 syntax)) ; string start 1747 (goto-char (nth 8 syntax)) ; string start
1748 (condition-case () ; for unbalanced quotes 1748 (setq end (condition-case () ; for unbalanced quotes
1749 (progn (forward-sexp) 1749 (progn (forward-sexp) (point))
1750 (setq end (point))) 1750 (error (point-max)))))
1751 (error (setq end (point-max)))))
1752 ((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced 1751 ((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced
1753 ; string 1752 ; string
1754 (forward-char) 1753 (forward-char)
1755 (setq end (point)) 1754 (setq end (point))
1756 (condition-case () 1755 (condition-case ()
1757 (progn (backward-sexp) 1756 (progn (backward-sexp)
1758 (setq start (point))) 1757 (setq start (point)))
1759 (error nil)))) 1758 (error (setq end nil)))))
1760 (when end 1759 (when end
1761 (save-restriction 1760 (save-restriction
1762 (narrow-to-region start end) 1761 (narrow-to-region start end)
1763 (goto-char orig) 1762 (goto-char orig)
1764 (fill-paragraph justify)))))) 1763 (let ((paragraph-separate
1765 t) 1764 ;; Make sure that fenced-string delimiters that stand
1765 ;; on their own line stay there.
1766 (concat "[ \t]*['\"]+[ \t]*$\\|" paragraph-separate)))
1767 (fill-paragraph justify))))))
1768 t))
1766 1769
1767 (defun python-shift-left (start end &optional count) 1770 (defun python-shift-left (start end &optional count)
1768 "Shift lines in region COUNT (the prefix arg) columns to the left. 1771 "Shift lines in region COUNT (the prefix arg) columns to the left.
1769 COUNT defaults to `python-indent'. If region isn't active, just shift 1772 COUNT defaults to `python-indent'. If region isn't active, just shift
1770 current line. The region shifted includes the lines in which START and 1773 current line. The region shifted includes the lines in which START and