all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8141: 23.2.94; python-fill-paragraph
@ 2011-02-28 20:56 Andreas Röhler
  2011-03-01  2:59 ` Christoph Scholtes
  2012-10-07 13:26 ` Fabián Ezequiel Gallina
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Röhler @ 2011-02-28 20:56 UTC (permalink / raw)
  To: 8141

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]


Hi,

attached a test file, revealing a bug in python-fill-paragraph already 
reported at lp, which pertains to python.el and python-mode.el likewise.

Patch attached.

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/

[-- Attachment #2: fill-paragraph-problems-lp710373-test.el --]
[-- Type: text/x-emacs-lisp, Size: 2277 bytes --]

(defun py-fill-paragraph-problems-lp:710373-test (&optional arg load-branch-function)
  (interactive "p")
  (when load-branch-function (funcall load-branch-function))
  (py-fill-paragraph-problems-lp:710373-test-intern arg))

(defun py-fill-paragraph-problems-lp:710373-test-intern (&optional arg)
  "If no `load-branch-function' is specified, make sure the appropriate branch is loaded. Otherwise default python-mode will be checked. "
  (let ((tmp-dir "/tmp/") 
        (fpp-exec-buffer "fill-paragraph-problems-lp:710373")
        (diff-buffer "fpp-lp:710373-old")
        (fpp-teststring "
    \"\"\"
    triple-quoted string containing \"quotation\" marks.
    triple-quoted string containing \"quotation\" marks.
    triple-quoted string containing \"quotation\" marks.
    triple-quoted string containing \"quotation\" marks.
    triple-quoted string containing \"quotation\" marks.
    \"\"\"
")
        erg)
    (set-buffer (get-buffer-create diff-buffer))
    (erase-buffer)
    (insert fpp-teststring)
    (write-file (concat tmp-dir diff-buffer))
    (if arg
        (progn
          (set-buffer (get-buffer-create fpp-exec-buffer))
          (when arg (switch-to-buffer (current-buffer)))
          (erase-buffer)
          (py-fill-paragraph-problems-lp:710373-test-base))
      (with-temp-buffer (py-fill-paragraph-problems-lp:710373-test-base)))))

(defun py-fill-paragraph-problems-lp:710373-test-base () 
  (python-mode)
  (insert fpp-teststring)
  (set-buffer fpp-exec-buffer)
  (font-lock-mode 1)
  (font-lock-fontify-buffer)
  (goto-char (point-min))
  (forward-line 3)
  (message "I'm here: %s" (point))
  (set-buffer-modified-p nil)
  ;;     (describe-function 'py-fill-paragraph)
  (setq fill-column 55)
  (if (functionp 'py-fill-paragraph)
      (py-fill-paragraph)
    (python-fill-paragraph))
  (write-file (concat tmp-dir fpp-exec-buffer))
  (setq erg (diff (concat tmp-dir fpp-exec-buffer) (concat tmp-dir diff-buffer) "-u"))
  (if (featurep 'xemacs)
      (progn
        (set-buffer "*Diff Output*")
        (switch-to-buffer (current-buffer)))
    (set-buffer erg)
    (sit-for 1)
    (assert (numberp (progn (goto-char (point-min))(search-forward "no differences" nil t 1))) t)
    (message "%s" "py-fill-paragraph-problems-lp:710373 passed")))

[-- Attachment #3: python.el.diff --]
[-- Type: text/x-patch, Size: 597 bytes --]

--- python.el	2011/02/28 20:22:31	1.1
+++ python.el	2011/02/28 20:24:23
@@ -2022,7 +2022,9 @@
 		;; current line.
 		((eq t (nth 3 syntax))	; in fenced string
 		 (goto-char (nth 8 syntax)) ; string start
-		 (setq start (line-beginning-position))
+                 (if (looking-at "\\(?:'''\\|\"\"\"\\|'\\|\"\\)\\\\?\n?")
+                     (setq start (match-end 0))
+                   (setq start (line-beginning-position)))
 		 (setq end (condition-case () ; for unbalanced quotes
                                (progn (forward-sexp)
                                       (- (point) 3))

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-07 13:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 20:56 bug#8141: 23.2.94; python-fill-paragraph Andreas Röhler
2011-03-01  2:59 ` Christoph Scholtes
2011-03-01 10:45   ` Andreas Röhler
2011-03-08  2:08     ` Stefan Monnier
2011-03-08 12:26       ` Andreas Röhler
2011-03-08 21:18         ` Stefan Monnier
2012-06-19  2:19           ` Glenn Morris
2012-10-07 13:26 ` Fabián Ezequiel Gallina

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.