Am 13.03.2011 21:09, schrieb Andrea Crotti:
Barry Warsaw<ba...@python.org> writes:
On Mar 13, 2011, at 12:49 PM, Andrea Crotti wrote:
I get a strange error when I have a situation like this:
--8<---------------cut here---------------start------------->8---
1 class Foo(object):
2 """
3 Some doc
4 """
5=09
--8<---------------cut here---------------end--------------->8---
if I go to line 5 and press tab I get the error as below, using:
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) of
2011-03-04
and python-mode from bzr (can I get automatically the revision from emacs=
?)
I cannot reproduce this with Emacs 23.2.1 on Ubuntu Natty and python-mode=
.el
r400.
-Barry
I thought it was something else interfering, but I've:
- update to rev400
- byte-compiled python-mode
- started a new emacs24 -Q
in the scratch buffer wrote as above, and still the same error...
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument integerp t)
make-string(1 t)
(and delim (make-string 1 delim))
(let ((skip (and delim (make-string 1 delim))) (continue t)) (when skip (=
save-excursion (while continue (py-safe (search-backward skip)) (setq conti=
nue (and (not (bobp)) (=3D (char-before) 92)))) (if (and (=3D (char-before)=
delim) (=3D (char-before (1- ...)) delim)) (setq skip (make-string 3 delim=
)))) (py-safe (search-backward skip))))
py-goto-beginning-of-tqs(t)
Hi Andrea,
thanks. Have some idea meanwhile wherefrom these bug. It's in the line
above, resp. it's receiving function.
Ironically you get this bug, because syntax setting is OK now with Emacs 24.
AFAIS bug results, because the delimiting char of a triple-quoted-string
is no longer of 7, string quote, but of 15, generic string.
syntax-ppss and friends than don't send the delimiting char as integer,
but `t'. The receiving functions refuses correctly to make a string from:
wrong-type-argument integerp t)
With some luck I'll send a fix next days...
Andreas
(cond ((or (and (nth 3 pps) (nth 3 boipps)) (and (nth 4 pps) (nth 4 boipp=
s))) (save-excursion (if (not py-align-multiline-strings-p) 0 (re-search-ba=
ckward "^[ ]*\\([^ \n#]\\|#[ \n]\\)" nil (quote move))
(back-to-indentat=
ion) (current-column)))) ((py-continuation-line-p) (let ((startpos (point))=
(open-bracket-pos (py-nesting-level)) endpos searching found state cind cl=
ine) (if open-bracket-pos (progn (setq endpos (py-point (quote bol))) (py-g=
oto-initial-line) (setq cind (current-indentation)) (setq cline cind) (doli=
st (bp (nth 9 ...) cind) (if (search-forward "\n" bp t) (setq cline cind)) =
(goto-char (1+ bp)) (skip-chars-forward " ") (setq cind (if ... ... ...)))=
) (forward-line -1) (if (py-continuation-line-p) (current-indentation) (end=
-of-line) (setq endpos (point) searching t) (back-to-indentation) (setq sta=
rtpos (point)) (while searching (skip-chars-forward "^=3D" endpos) (if (=3D=
... endpos) (setq searching nil) (forward-char 1) (setq state ...) (if ...=
...))) (if (or (not found) (looking-at "[ ]*\\\\")) (progn (goto-char sta=
rtpos) (skip-chars-forward "^ \n"))) (+ (current-column) (if (py-statement=
-opens-block-p) py-continuation-offset 0) 1))))) ((bobp) (current-indentati=
on)) ((and (looking-at "[ ]*#[^ \n]") (fboundp (quote forward-comment)) (=
<=3D (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-commen=
t (- (point-max))) (let ((prefix-re (concat py-block-comment-prefix "[ ]*"=
)) done) (while (not done) (re-search-backward "^[ ]*\\([^
\n#]\\|#\\)" n=
il (quote move)) (setq done (or (bobp) (and ... ...) (and ... ...)))))) (py=
-goto-beginning-of-tqs (nth 3 (parse-partial-sexp bod (point)))) (setq plac=
eholder (point)) (py-goto-initial-line) (py-goto-beginning-of-tqs (save-exc=
ursion (nth 3 (parse-partial-sexp placeholder (point))))) (+ (current-inden=
tation) (if (py-statement-opens-block-p) py-indent-offset (if (and honor-bl=
ock-close-p (py-statement-closes-block-p)) (- py-indent-offset) 0)))))
(let* ((bod (py-point (quote bod))) (pps (parse-partial-sexp bod (point))=
) (boipps (parse-partial-sexp bod (py-point (quote boi)))) placeholder) (co=
nd ((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-backwar=
d "^[ ]*\\([^ \n#]\\|#[ \n]\\)" nil (quote move))
(back-to-indentation) =
(current-column)))) ((py-continuation-line-p) (let ((startpos (point)) (ope=
n-bracket-pos (py-nesting-level)) endpos searching found state cind cline) =
(if open-bracket-pos (progn (setq endpos (py-point ...)) (py-goto-initial-l=
ine) (setq cind (current-indentation)) (setq cline cind) (dolist (bp ... ci=
nd) (if ... ...) (goto-char ...) (skip-chars-forward " ") (setq cind ...))=
) (forward-line -1) (if (py-continuation-line-p) (current-indentation) (end=
-of-line) (setq endpos (point) searching t) (back-to-indentation) (setq sta=
rtpos (point)) (while searching (skip-chars-forward "^=3D" endpos) (if ... =
... ... ... ...)) (if (or ... ...) (progn ... ...)) (+ (current-column) (if=
... py-continuation-offset 0) 1))))) ((bobp) (current-indentation)) ((and =
(looking-at "[ ]*#[^ \n]") (fboundp (quote forward-comment)) (<=3D (curre=
nt-indentation) (save-excursion (forward-comment (- ...)) (current-indentat=
ion)))) (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
(no=
t done) (re-search-backward "^[ ]*\\([^ \n#]\\|#\\)" nil (quote
move)) (s=
etq done (or ... ... ...))))) (py-goto-beginning-of-tqs (nth 3 (parse-parti=
al-sexp bod (point)))) (setq placeholder (point)) (py-goto-initial-line) (p=
y-goto-beginning-of-tqs (save-excursion (nth 3 (parse-partial-sexp placehol=
der (point))))) (+ (current-indentation) (if (py-statement-opens-block-p) p=
y-indent-offset (if (and honor-block-close-p (py-statement-closes-block-p))=
(- py-indent-offset) 0))))))
(save-excursion (beginning-of-line) (let* ((bod (py-point (quote bod))) (=
pps (parse-partial-sexp bod (point))) (boipps (parse-partial-sexp bod (py-p=
oint (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-multi=
line-strings-p) 0 (re-search-backward "^[ ]*\\([^ \n#]\\|#[
\n]\\)" nil =
(quote move)) (back-to-indentation) (current-column)))) ((py-continuation-l=
ine-p) (let ((startpos (point)) (open-bracket-pos (py-nesting-level)) endpo=
s searching found state cind cline) (if open-bracket-pos (progn (setq endpo=
s ...) (py-goto-initial-line) (setq cind ...) (setq cline cind) (dolist ...=
... ... ... ...)) (forward-line -1) (if (py-continuation-line-p) (current-=
indentation) (end-of-line) (setq endpos ... searching t) (back-to-indentati=
on) (setq startpos ...) (while searching ... ...) (if ... ...) (+ ... ... 1=
))))) ((bobp) (current-indentation)) ((and (looking-at "[ ]*#[^ \n]") (fb=
oundp (quote forward-comment)) (<=3D (current-indentation) (save-excursion =
(forward-comment ...) (current-indentation)))) (current-indentation)) (t (i=
f (and (eq py-honor-comment-indentation nil) (fboundp (quote forward-commen=
t))) (forward-comment (- (point-max))) (let ((prefix-re ...) done) (while (=
not done) (re-search-backward "^[ ]*\\([^ \n#]\\|#\\)" nil ...) (setq
don=
e ...)))) (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 ...)))) (+ (curr=
ent-indentation) (if (py-statement-opens-block-p) py-indent-offset (if (and=
honor-block-close-p ...) (- py-indent-offset) 0)))))))
py-compute-indentation(t)
(let* ((ci (current-indentation)) (move-to-indentation-p (<=3D (current-c=
olumn) ci)) (need (py-compute-indentation (not arg))) (cc (current-column))=
) (if (and (equal last-command this-command) (/=3D cc 0)) (progn (beginning=
-of-line) (delete-horizontal-space) (indent-to (* (/ (- cc 1) py-indent-off=
set) py-indent-offset))) (progn (if (py-outdent-p) (setq need (- need py-in=
dent-offset))) (if (or py-tab-always-indent move-to-indentation-p) (progn (=
if (/=3D ci need) (save-excursion (beginning-of-line) (delete-horizontal-sp=
ace) (indent-to need))) (if move-to-indentation-p (back-to-indentation))) (=
insert-tab)))))
py-indent-line()
indent-for-tab-command(nil)
call-interactively(indent-for-tab-command nil nil)
--8<---------------cut here---------------end--------------->8---
_______________________________________________
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode
_______________________________________________
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode