Re: [Python-mode] Error during indentation

2011-03-14 Thread Andreas Röhler

Am 13.03.2011 21:09, schrieb Andrea Crotti:

Barry Warsawba...@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 ...) 

Re: [Python-mode] Error during indentation

2011-03-14 Thread Andrea Crotti
Andreas Röhler andreas.roeh...@online.de writes:

 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


Thanks very good I'll be glad to try the fix then :)
Actually the workaround is not so bad, it's enough to write 4 spaces by
hand, but it would be good to get fixed also for the future emacs24
(which by the way is very stable and looks faster).
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode


[Python-mode] Error during indentation

2011-03-13 Thread Andrea Crotti

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  
--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?)

--8---cut here---start-8---
Debugger entered--Lisp error: (wrong-type-argument integerp t)
  make-string(1 t)
  py-goto-beginning-of-tqs(t)
  py-compute-indentation(t)
  py-indent-line()
  indent-for-tab-command(nil)
  call-interactively(indent-for-tab-command)
  (progn (setq this-command command) (call-interactively command))
  (if (and (commandp command) (not (string-match yas/expand (symbol-name 
command (progn (setq this-command command) (call-interactively command)))
  (when (and (commandp command) (not (string-match yas/expand (symbol-name 
command (setq this-command command) (call-interactively command))
  (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 
(this-command-keys-vector)) (keys-2 (and yas/trigger-key from-trigger-key-p 
(stringp yas/trigger-key) (read-kbd-macro yas/trigger-key))) (command-1 (and 
keys-1 (key-binding keys-1))) (command-2 (and keys-2 (key-binding keys-2))) 
(command (or (and (symbolp command-1) (not (string-match yas/expand 
(symbol-name command-1))) command-1) (and (symbolp command-2) command-2 
(when (and (commandp command) (not (string-match yas/expand (symbol-name 
command (setq this-command command) (call-interactively command)))
  (cond ((eq yas/fallback-behavior (quote return-nil)) nil) ((eq 
yas/fallback-behavior (quote call-other-command)) (let* ((yas/minor-mode nil) 
(yas/direct-keymaps nil) (keys-1 (this-command-keys-vector)) (keys-2 (and 
yas/trigger-key from-trigger-key-p (stringp yas/trigger-key) (read-kbd-macro 
yas/trigger-key))) (command-1 (and keys-1 (key-binding keys-1))) (command-2 
(and keys-2 (key-binding keys-2))) (command (or (and (symbolp command-1) (not 
...) command-1) (and (symbolp command-2) command-2 (when (and (commandp 
command) (not (string-match yas/expand (symbol-name command (setq 
this-command command) (call-interactively command ((and (listp 
yas/fallback-behavior) (cdr yas/fallback-behavior) (eq (quote apply) (car 
yas/fallback-behavior))) (if (cddr yas/fallback-behavior) (apply (cadr 
yas/fallback-behavior) (cddr yas/fallback-behavior)) (when (commandp (cadr 
yas/fallback-behavior)) (setq this-command (cadr yas/fallback-behavior)) 
(call-interactively (cadr yas/fall
 back-behavior) (t nil))
  yas/fallback(trigger-key)
  (if (and templates-and-pos (first templates-and-pos)) 
(yas/expand-or-prompt-for-template (first templates-and-pos) (second 
templates-and-pos) (third templates-and-pos)) (yas/fallback (quote 
trigger-key)))
  (let (templates-and-pos) (unless (and yas/expand-only-for-last-commands (not 
(member last-command yas/expand-only-for-last-commands))) (setq 
templates-and-pos (if field (save-restriction (narrow-to-region 
(yas/field-start field) (yas/field-end field)) (yas/current-key)) 
(yas/current-key (if (and templates-and-pos (first templates-and-pos)) 
(yas/expand-or-prompt-for-template (first templates-and-pos) (second 
templates-and-pos) (third templates-and-pos)) (yas/fallback (quote 
trigger-key
  yas/expand()
  call-interactively(yas/expand nil nil)

--8---cut here---end---8---
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode


Re: [Python-mode] Error during indentation

2011-03-13 Thread Andreas Röhler

Am 13.03.2011 12:49, schrieb Andrea Crotti:


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 
--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?)


you may subscribe for mail at

https://code.launchpad.net/~python-mode-devs/python-mode/python-mode

then you will get a mail always the branch is updated

Afterwards do

bzr branch lp:python-mode

BTW : can't reproduce the bug.

Andreas




--8---cut here---start-8---
Debugger entered--Lisp error: (wrong-type-argument integerp t)
   make-string(1 t)
   py-goto-beginning-of-tqs(t)
   py-compute-indentation(t)
   py-indent-line()
   indent-for-tab-command(nil)
   call-interactively(indent-for-tab-command)
   (progn (setq this-command command) (call-interactively command))
   (if (and (commandp command) (not (string-match yas/expand (symbol-name 
command (progn (setq this-command command) (call-interactively command)))
   (when (and (commandp command) (not (string-match yas/expand (symbol-name 
command (setq this-command command) (call-interactively command))
   (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 (this-command-keys-vector)) (keys-2 
(and yas/trigger-key from-trigger-key-p (stringp yas/trigger-key) (read-kbd-macro 
yas/trigger-key))) (command-1 (and keys-1 (key-binding keys-1))) (command-2 (and keys-2 
(key-binding keys-2))) (command (or (and (symbolp command-1) (not (string-match 
yas/expand (symbol-name command-1))) command-1) (and (symbolp command-2) command-2 
(when (and (commandp command) (not (string-match yas/expand (symbol-name command 
(setq this-command command) (call-interactively command)))
   (cond ((eq yas/fallback-behavior (quote return-nil)) nil) ((eq yas/fallback-behavior 
(quote call-other-command)) (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 
(this-command-keys-vector)) (keys-2 (and yas/trigger-key from-trigger-key-p (stringp 
yas/trigger-key) (read-kbd-macro yas/trigger-key))) (command-1 (and keys-1 (key-binding 
keys-1))) (command-2 (and keys-2 (key-binding keys-2))) (command (or (and (symbolp 
command-1) (not ...) command-1) (and (symbolp command-2) command-2 (when (and 
(commandp command) (not (string-match yas/expand (symbol-name command 
(setq this-command command) (call-interactively command ((and (listp 
yas/fallback-behavior) (cdr yas/fallback-behavior) (eq (quote apply) (car 
yas/fallback-behavior))) (if (cddr yas/fallback-behavior) (apply (cadr 
yas/fallback-behavior) (cddr yas/fallback-behavior)) (when (commandp (cadr 
yas/fallback-behavior)) (setq this-command (cadr yas/fallback-behavior)) 
(call-interactively (cadr yas/f

all

  back-behavior) (t nil))
   yas/fallback(trigger-key)
   (if (and templates-and-pos (first templates-and-pos)) 
(yas/expand-or-prompt-for-template (first templates-and-pos) (second 
templates-and-pos) (third templates-and-pos)) (yas/fallback (quote 
trigger-key)))
   (let (templates-and-pos) (unless (and yas/expand-only-for-last-commands (not 
(member last-command yas/expand-only-for-last-commands))) (setq 
templates-and-pos (if field (save-restriction (narrow-to-region 
(yas/field-start field) (yas/field-end field)) (yas/current-key)) 
(yas/current-key (if (and templates-and-pos (first templates-and-pos)) 
(yas/expand-or-prompt-for-template (first templates-and-pos) (second 
templates-and-pos) (third templates-and-pos)) (yas/fallback (quote 
trigger-key
   yas/expand()
   call-interactively(yas/expand 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