Fill paragraph problems

Bug #710373 reported by Skip Montanaro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Undecided
Andreas Roehler

Bug Description

From Andreas's paragraph-fill-warts branch, rev 401, XEmacs 21.4.22, Mac OS X 10.5.8...
When trying to format the docstring in the attached file I get this error if I use fill-paragraph:

  Symbol's function definition is void: py-in-statement-p

and this error if I use py-fill-paragraph:

  Wrong number of arguments: (lambda (honor-block-close-p) "Compute Python indentation.
  When HONOR-BLOCK-CLOSE-P is non-nil, statements such as `return',
  `raise', `break', `continue', and `pass' force one level of
  dedenting." (save-excursion (beginning-of-line) (let* ((bod (py-point (quote bod))) (pps (parse-partial-sexp bod (point))) (boipps (parse-partial-sexp bod (py-point (quote boi)))) placeholder) (cond ((or (and (nth 3 pps) (nth 3 boipps)) (and (nth 4 pps) (nth 4 boipps))) (save-excursion (if (not py-align-multiline-strings-p) 0 (re-search-backward "^[ ]*\\([^
  #]\\|#[
  ]\\)" nil (quote move)) (back-to-indentation) (current-column)))) ((py-continuation-line-p) (let ((startpos (point)) (open-bracket-pos (py-nesting-level)) endpos searching found state cind cline) (if open-bracket-pos (progn (setq endpos (py-point (quote bol))) (py-goto-initial-line) (setq cind (current-indentation)) (setq cline cind) (dolist (bp (nth 9 (save-excursion (parse-partial-sexp (point) endpos))) cind) (if (search-forward "
  " bp t) (setq cline cind)) (goto-char (1+ bp)) (skip-chars-forward " ") (setq cind (if (memq (following-char) (quote (?\n ?\# ?\\))) (+ cline py-indent-offset) (current-column))))) (forward-line -1) (if (py-continuation-line-p) (current-indentation) (end-of-line) (setq endpos (point) searching t) (back-to-indentation) (setq startpos (point)) (while searching (skip-chars-forward "^=" endpos) (if (= (point) endpos) (setq searching nil) (forward-char 1) (setq state (parse-partial-sexp startpos (point))) (if (and (zerop (car state)) (null (nth 3 state))) (progn (setq searching nil) (setq found (not (or (eq (following-char) ?=) (memq (char-after (- (point) 2)) (quote (?< ?> ?!)))))))))) (if (or (not found) (looking-at "[ ]*\\\\")) (progn (goto-char startpos) (skip-chars-forward "^
  "))) (+ (current-column) (if (py-statement-opens-block-p) py-continuation-offset 0) 1))))) ((bobp) (current-indentation)) ((and (looking-at "[ ]*#[^
  ]") (fboundp (quote forward-comment)) (<= (current-indentation) (save-excursion (forward-comment (- (point-max))) (current-indentation)))) (current-indentation)) (t (if (and (eq py-honor-comment-indentation nil) (fboundp (quote forward-comment))) (forward-comment (- (point-max))) (let ((prefix-re (concat py-block-comment-prefix "[ ]*")) done) (while (not done) (re-search-backward "^[ ]*\\([^
  #]\\|#\\)" nil (quote move)) (setq done (or (bobp) (and (eq py-honor-comment-indentation t) (save-excursion (back-to-indentation) (not (looking-at prefix-re)))) (and (not (eq py-honor-comment-indentation t)) (save-excursion (back-to-indentation) (and (not (looking-at prefix-re)) (or (looking-at "[^#]") (not (zerop (current-column)))))))))))) (py-goto-beginning-of-tqs (nth 3 (parse-partial-sexp bod (point)))) (setq placeholder (point)) (py-goto-initial-line) (py-goto-beginning-of-tqs (save-excursion (nth 3 (parse-partial-sexp placeholder (point))))) (+ (current-indentation) (if (py-statement-opens-block-p) py-indent-offset (if (and honor-block-close-p (py-statement-closes-block-p)) (- py-indent-offset) 0)))))))), 0

Related branches

Revision history for this message
Skip Montanaro (smontanaro) wrote :
Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 710373] [NEW] Fill paragraph problems
Download full text (3.8 KiB)

Am 30.01.2011 23:15, schrieb Skip Montanaro:
> Public bug reported:
>
>> From Andreas's paragraph-fill-warts branch, rev 401, XEmacs 21.4.22, Mac OS X 10.5.8...
> When trying to format the docstring in the attached file I get this error if I use fill-paragraph:
>
> Symbol's function definition is void: py-in-statement-p

Thanks,

thats a newly created from components branch.

Will take occasion to strip down and a select all needed stuff into one
additional file.

So we get rid of all the "required" added lately, keeping just one.

Will call the new one "python-add-on.el"

Unless other proposals, comments welcome.

Andreas

>
> and this error if I use py-fill-paragraph:
>
>
> Wrong number of arguments: (lambda (honor-block-close-p) "Compute Python indentation.
> When HONOR-BLOCK-CLOSE-P is non-nil, statements such as `return',
> `raise', `break', `continue', and `pass' force one level of
> dedenting." (save-excursion (beginning-of-line) (let* ((bod (py-point (quote bod))) (pps (parse-partial-sexp bod (point))) (boipps (parse-partial-sexp bod (py-point (quote boi)))) placeholder) (cond ((or (and (nth 3 pps) (nth 3 boipps)) (and (nth 4 pps) (nth 4 boipps))) (save-excursion (if (not py-align-multiline-strings-p) 0 (re-search-backward "^[ ]*\\([^
> #]\\|#[
> ]\\)" nil (quote move)) (back-to-indentation) (current-column)))) ((py-continuation-line-p) (let ((startpos (point)) (open-bracket-pos (py-nesting-level)) endpos searching found state cind cline) (if open-bracket-pos (progn (setq endpos (py-point (quote bol))) (py-goto-initial-line) (setq cind (current-indentation)) (setq cline cind) (dolist (bp (nth 9 (save-excursion (parse-partial-sexp (point) endpos))) cind) (if (search-forward "
> " bp t) (setq cline cind)) (goto-char (1+ bp)) (skip-chars-forward " ") (setq cind (if (memq (following-char) (quote (?\n ?\# ?\\))) (+ cline py-indent-offset) (current-column))))) (forward-line -1) (if (py-continuation-line-p) (current-indentation) (end-of-line) (setq endpos (point) searching t) (back-to-indentation) (setq startpos (point)) (while searching (skip-chars-forward "^=" endpos) (if (= (point) endpos) (setq searching nil) (forward-char 1) (setq state (parse-partial-sexp startpos (point))) (if (and (zerop (car state)) (null (nth 3 state))) (progn (setq searching nil) (setq found (not (or (eq (following-char) ?=) (memq (char-after (- (point) 2)) (quote (?< ?> ?!)))))))))) (if (or (not found) (looking-at "[ ]*\\\\")) (progn (goto-char startpos) (skip-chars-forward "^
> "))) (+ (current-column) (if (py-statement-opens-block-p) py-continuation-offset 0) 1))))) ((bobp) (current-indentation)) ((and (looking-at "[ ]*#[^
> ]") (fboundp (quote forward-comment)) (<= (current-indentation) (save-excursion (forward-comment (- (point-max))) (current-indentation)))) (current-indentation)) (t (if (and (eq py-honor-comment-indentation nil) (fboundp (quote forward-comment))) (forward-comment (- (point-max))) (let ((prefix-re (concat py-block-comment-prefix "[ ]*")) done) (while (not done) (re-search-backward "^[ ]*\\([^
> #]\\|#\\)" nil (quote move)) (setq done (or (bobp) (and (eq py-honor-comment-indentation t) (...

Read more...

Changed in python-mode:
status: New → Confirmed
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Am 30.01.2011 23:15, schrieb Skip Montanaro:
> Public bug reported:
>
>> From Andreas's paragraph-fill-warts branch, rev 401, XEmacs 21.4.22, Mac OS X 10.5.8...
> When trying to format the docstring in the attached file I get this error if I use fill-paragraph:
>
> Symbol's function definition is void: py-in-statement-p
>
> and this error if I use py-fill-paragraph:
>

Hi Skip,

could you try the python-mode-components branch?

It's build around `py-in-statement-p' missed here.
Everything is done by moving statement by statement.
All check done hereafter.

It's much easier to debug than the classic mode, it's
daily in use here for months.

Everything else backported...

If we could proceed from python-mode-components branch,
we get the flying carpet :-) cc to Barry therefor

Andreas

Changed in python-mode:
status: Confirmed → Fix Committed
Changed in python-mode:
milestone: none → 1.0
milestone: 1.0 → none
milestone: none → 6.0
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.