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] highlight-indentation

2011-03-14 Thread Anton Johansson
Hi, if you can forward bug tracking automatically, please do, otherwise it's ok 
don't overwork it :) Also the full functionality of highlight-indentation is 
basically:

(setq highlight-indent-offset 4) ;; Spaces indent level
(font-lock-add-keywords nil `((,(format \\( \\) \\{%s\\} (- 
highlight-indent-offset 1)) (1 'highlight-indent-face

so if you find a better place to extract that to syntax highlighting code it 
might be better...

Cheers
-- Anton

On Mar 13, 2011, at 09:15 , Andreas Röhler wrote:

 Hi Anton,
 
 thanks a lot BTW.
 
 Added a link onto your repo into the header.
 
 In order to get a wider audience with resp. to other modes an entry
 at
 
 http://www.emacswiki.org/emacs-en
 
 might be useful.
 
 
 As for bug-tracking think we should forward any report to you, if it concerns 
 your file(s). OTOH would not charge the users which such specific requests.
 
 Agreed?
 
 Thanks again.
 
 
 Andreas
 
 --
 https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
 https://code.launchpad.net/s-x-emacs-werkstatt/
 
 
 
 
 Am 12.03.2011 11:38, schrieb Anton Johansson:
 Hello,
 
 I'm absolutely cool with you guys using the code in any way you find
 suitable, nice to see some people finding it useful!
 
 Like you have discussed before, there are some issues with
 highlight-indentation.el that could be handled better, for example
 highlighting spaces that are not in the leading whitespace. If you can
 find a good way to link to my repo so that people can submit possible
 fixes that would be good since the code is also usable in other modes.
 
 Cheers
 -Anton
 
 On Sat, Mar 12, 2011 at 4:28 AM, Barry Warsawba...@python.org  wrote:
 Hi Andreas,
 
 I noticed that you committed this file to our bzr tree.  I'm concerned about
 doing this without Anton's approval (and maybe even with it).  Anton 
 probably
 has his own source code repository, so at the very least it would be more
 effort for us to keep our copy up-to-date with his.  python-mode.el doesn't
 depend on his code, so it's really not necessary for us to have a copy in 
 our
 tree.
 
 As cool as Anton's module is, and it definitely could help Python 
 programmers,
 it's probably a better idea to add a reference to his work (and his download
 site or source repository) in our README file or in the comments at the top 
 of
 python-mode.el.
 
 If Anton really wants us to keep the canonical version of his mode in our 
 bzr
 tree, we could discuss that.  Anton, what do you think?
 
 Cheers,
 -Barry
 
 
 

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


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] running Python tests

2011-03-14 Thread Yaroslav Halchenko
Dear Python-mode gurus,

could someone look into adopting at least minimalistic convenience to
run unittests from within emacs? e.g.

https://bitbucket.org/jpellerin/nosemacs

seems to be doing its minimal job just fine

-- 
=--=
Keep in touch www.onerussian.com
Yaroslav Halchenko www.ohloh.net/accounts/yarikoptic
___
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode