emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/python.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/python.el,v
Date: Thu, 01 Mar 2007 15:07:46 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        07/03/01 15:07:45

Index: progmodes/python.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- progmodes/python.el 21 Jan 2007 03:20:44 -0000      1.53
+++ progmodes/python.el 1 Mar 2007 15:07:44 -0000       1.54
@@ -163,7 +163,7 @@
               (= (match-beginning 1) (match-end 1))) ; prefix is null
          (and (= n 1)                  ; prefix
               (/= (match-beginning 1) (match-end 1)))) ; non-empty
-      (unless (eq 'string (syntax-ppss-context (syntax-ppss)))
+      (unless (nth 3 (syntax-ppss))
         (eval-when-compile (string-to-syntax "|"))))
      ;; Otherwise (we're in a non-matching string) the property is
      ;; nil, which is OK.
@@ -1745,10 +1745,9 @@
               end)
          (cond ((eq t (nth 3 syntax))      ; in fenced string
                 (goto-char (nth 8 syntax)) ; string start
-                (condition-case ()         ; for unbalanced quotes
-                    (progn (forward-sexp)
-                           (setq end (point)))
-                  (error (setq end (point-max)))))
+                (setq end (condition-case () ; for unbalanced quotes
+                               (progn (forward-sexp) (point))
+                             (error (point-max)))))
                ((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced
                                                           ; string
                 (forward-char)
@@ -1756,13 +1755,17 @@
                 (condition-case ()
                     (progn (backward-sexp)
                            (setq start (point)))
-                  (error nil))))
+                  (error (setq end nil)))))
          (when end
            (save-restriction
              (narrow-to-region start end)
              (goto-char orig)
+              (let ((paragraph-separate
+                     ;; Make sure that fenced-string delimiters that stand
+                     ;; on their own line stay there.
+                     (concat "[ \t]*['\"]+[ \t]*$\\|" paragraph-separate)))
              (fill-paragraph justify))))))
-      t)
+      t))
 
 (defun python-shift-left (start end &optional count)
   "Shift lines in region COUNT (the prefix arg) columns to the left.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]