aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier2007-03-01 15:07:45 +0000
committerStefan Monnier2007-03-01 15:07:45 +0000
commitfc553234b5d93ae3ab0235b00a3d9fbcc5e74f4c (patch)
tree91df253db3fcca09529a0e960bb89399e393a1ed /lisp/progmodes/python.el
parent404a2a4b527cf3c87783173b13b47a1787dcd6f2 (diff)
downloademacs-fc553234b5d93ae3ab0235b00a3d9fbcc5e74f4c.tar.gz
emacs-fc553234b5d93ae3ab0235b00a3d9fbcc5e74f4c.zip
(python-quote-syntax): Don't bother with syntax-ppss-context.
(python-fill-paragraph): Make sure that fenced-string delimiters that stand on their own line stay there
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f94a3d63653..38e846aa2cc 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -163,7 +163,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)."
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.
@@ -1743,12 +1743,11 @@ Otherwise, do nothing."
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)
@@ -1756,13 +1755,17 @@ Otherwise, do nothing."
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.