unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [joakim@verona.se: pyhon mode indentation problem]
@ 2006-06-15 15:09 Richard Stallman
  2006-06-15 16:44 ` Slawomir Nowaczyk
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2006-06-15 15:09 UTC (permalink / raw


Maybe someone would like to work on this.

------- Start of forwarded message -------
From: joakim@verona.se
To: emacs-pretest-bug@gnu.org
Date: Wed, 14 Jun 2006 13:02:36 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: pyhon mode indentation problem
X-Spam-Status: No, score=0.2 required=5.0 tests=NO_REAL_NAME autolearn=no 
	version=3.0.4

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

python mode auto indentation has been broken for me for some time.
I tried again today and it works better, but not much.

I tried using emacs -nw -q and the little python program below.

the problem is  especially obvious on the line marked #1, or #2
Try moving the indentation to column 0. Emacs will say "sole
indentation". 

I'm expecting indentation to go 4 spaces in under the "for" or the
"if" statement.



#!/usr/bin/python
import os

loop=0
missingfiles=0
for filenum in range(1,471):
    filename="%03d.pgm"%filenum #1
#print(filename)
    if not os.access(filename,os.F_OK):
    missingfiles=missingfiles+1
    print "%s "%filename ,
    loop=loop+1
    if loop==20:
       loop=0 #2
       print 
print
print "missing files:%d"%missingfiles


I had a look at python.el, and at line 510 there is code like:
		      (or (cond ((python-open-block-statement-p t)
				 python-indent)

I would expect (python-open-block-statement-p t) to return t, and the
indentation to occur, but it returns nil. However, I have no idea how
this code is supposed to work, so take this with a grain of salt.



If emacs crashed, and you have the emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/share/emacs/22.0.51/etc/DEBUG for instructions.


In GNU Emacs 22.0.51.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars, multi-tty)
 of 2006-04-11 on kurono.home
configured using `configure '--with-x-toolkit=lucid' '--with-xpm' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  display-time-mode: t
  show-paren-mode: t
  erc-truncate-mode: t
  erc-spelling-mode: t
  erc-log-mode: t
  erc-bbdb-mode: t
  erc-autoaway-mode: t
  erc-autojoin-mode: t
  erc-button-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-smiley-mode: t
  erc-irccontrols-mode: t
  senator-minor-mode: t
  which-function-mode: t
  semantic-idle-summary-mode: t
  semantic-idle-scheduler-mode: t
  auto-compression-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
C-s ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A 
ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A ESC O A ESC O B ESC O B ESC O B TAB TAB TAB TAB 
TAB TAB TAB TAB TAB TAB TAB C-x C-s C-x C-g ESC x e 
m a c s SPC b SPC u SPC DEL DEL r e SPC DEL C-a C-k 
r e p o r t SPC e m SPC b SPC RET

Recent messages:
Wrote /home/joakim/bin/missing
No buffer matching `2', create one? (y or n) 
Quit
Preparing diary... [2 times]
Closes for filenum in range(1,471):
Sole indentation [6 times]
Wrote /home/joakim/bin/missing
incremental parser error: "Wrong type argument: consp, nil" [3 times]
Wrote /home/joakim/bin/missing [2 times]
Loading emacsbug...done

- -- 
Joakim Verona
http://www.verona.se


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

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

* Re: [joakim@verona.se: pyhon mode indentation problem]
  2006-06-15 15:09 [joakim@verona.se: pyhon mode indentation problem] Richard Stallman
@ 2006-06-15 16:44 ` Slawomir Nowaczyk
  2006-06-15 17:20   ` joakim
  2006-06-16 15:06   ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Slawomir Nowaczyk @ 2006-06-15 16:44 UTC (permalink / raw
  Cc: joakim

On Thu, 15 Jun 2006 11:09:49 -0400
Richard Stallman <rms@gnu.org> wrote:

#> Maybe someone would like to work on this.

This particular thing is, AFAIU, not a bug.

Nevertheless, is anybody maintaining python.el? I tried using it once
and it seemed rather cumbersome. I am not sure if I have time and/or
skills to improve it... but if nobody else is working on it, I might
give it a shot.

#> the problem is especially obvious on the line marked #1, or #2 Try
#> moving the indentation to column 0. Emacs will say "sole
#> indentation".

I am not sure I understand:

If I move the #1 line so that it starts at column 0 (i.e. is not
indentated at all) and press TAB, it will indent correctly, with 4
spaces. After that, though, subsequent TABs will result in "sole
indentation" message -- this is a feature: TAB in python-mode cycles
through all possible (syntactically valid) indentations (of which
there is only one in this case).

Or did you mean something else by "moving the indentation to column 0"?

Similarly, calling 'indent-for-tab-command' (this is what TAB is bound
for me in emacs -q) on line #2 indents it properly with 4 spaces (it
is indented with 3 in your email). Subsequent TABs give message "sole
indentation" -- which it is.

What did you expect to happen?

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

Never attribute to malice that which can be adequately
explained by stupidity.

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

* Re: [joakim@verona.se: pyhon mode indentation problem]
  2006-06-15 16:44 ` Slawomir Nowaczyk
@ 2006-06-15 17:20   ` joakim
  2006-06-15 22:37     ` Slawomir Nowaczyk
  2006-06-16 15:06   ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: joakim @ 2006-06-15 17:20 UTC (permalink / raw
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

I posted some more info on this on "bugs" list.

Short recap:
- It doesnt work for me like it does for you, but it did, in an older
emacs

- I can solve this problem with this redefinition:

(defun python-skip-comments/blanks (&optional backward)
  "Skip comments and blank lines.
BACKWARD non-nil means go backwards, otherwise go forwards.  Backslash is
treated as whitespace so that continued blank lines are skipped.
Doesn't move out of comments -- should be outside or at end of line."
  (with-syntax-table python-space-backslash-table
    (forward-comment (if backward
			 ;(+ most-negative-fixnum 1000)
                         -10000000
		       most-positive-fixnum))))
(only change is the large negative value, not quite as large as most-negative-fixnum)
so, it seems like a bug in "forward-comment", at least here, in my setup.



> On Thu, 15 Jun 2006 11:09:49 -0400
> Richard Stallman <rms@gnu.org> wrote:
>
> #> Maybe someone would like to work on this.
>
> This particular thing is, AFAIU, not a bug.
>
> Nevertheless, is anybody maintaining python.el? I tried using it once
> and it seemed rather cumbersome. I am not sure if I have time and/or
> skills to improve it... but if nobody else is working on it, I might
> give it a shot.
>
> #> the problem is especially obvious on the line marked #1, or #2 Try
> #> moving the indentation to column 0. Emacs will say "sole
> #> indentation".
>
> I am not sure I understand:
>
> If I move the #1 line so that it starts at column 0 (i.e. is not
> indentated at all) and press TAB, it will indent correctly, with 4
> spaces. After that, though, subsequent TABs will result in "sole
> indentation" message -- this is a feature: TAB in python-mode cycles
> through all possible (syntactically valid) indentations (of which
> there is only one in this case).
>
> Or did you mean something else by "moving the indentation to column 0"?
>
> Similarly, calling 'indent-for-tab-command' (this is what TAB is bound
> for me in emacs -q) on line #2 indents it properly with 4 spaces (it
> is indented with 3 in your email). Subsequent TABs give message "sole
> indentation" -- which it is.
>
> What did you expect to happen?
>
> -- 
>  Best wishes,
>    Slawomir Nowaczyk
>      ( slawomir.nowaczyk.847@student.lu.se )
>
> Never attribute to malice that which can be adequately
> explained by stupidity.

-- 
Joakim Verona
http://www.verona.se

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

* Re: [joakim@verona.se: pyhon mode indentation problem]
  2006-06-15 17:20   ` joakim
@ 2006-06-15 22:37     ` Slawomir Nowaczyk
  0 siblings, 0 replies; 6+ messages in thread
From: Slawomir Nowaczyk @ 2006-06-15 22:37 UTC (permalink / raw
  Cc: emacs-devel

On Thu, 15 Jun 2006 19:20:15 +0200
joakim@verona.se wrote:

#> Short recap:
#> - It doesnt work for me like it does for you, but it did, in an
#>   older emacs

OK, I have just compiled a current cvs checkout:

In GNU Emacs 22.0.50.1 (i386-msvc-nt5.1.2600)
 of 2006-06-15 on FIONA

and it is still working for me. Maybe you could try a newer version as
well? Your bug report indicates your Emacs is over two months old: 

#> In GNU Emacs 22.0.51.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars, multi-tty)
#>  of 2006-04-11 on kurono.home

The bug might have been fixed already (especially if you are right and
it was in 'forward-comment')

#> - I can solve this problem with this redefinition:

This doesn't seem to be the right fix, so I think it would be better
to first determine why does it work for me and not for you.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( Slawomir.Nowaczyk@cs.lth.se )

Conscience is what hurts when everything else feels so good.

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

* Re: [joakim@verona.se: pyhon mode indentation problem]
  2006-06-15 16:44 ` Slawomir Nowaczyk
  2006-06-15 17:20   ` joakim
@ 2006-06-16 15:06   ` Richard Stallman
  2006-06-16 16:34     ` joakim
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2006-06-16 15:06 UTC (permalink / raw
  Cc: joakim, emacs-devel

Stefan Monnier does a little work on python.el, but I'd say that
nobody is really maintaining it.  No work has been done recently on
the indentation.  So you may as well try.

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

* Re: [joakim@verona.se: pyhon mode indentation problem]
  2006-06-16 15:06   ` Richard Stallman
@ 2006-06-16 16:34     ` joakim
  0 siblings, 0 replies; 6+ messages in thread
From: joakim @ 2006-06-16 16:34 UTC (permalink / raw
  Cc: Slawomir Nowaczyk, emacs-devel

Richard Stallman <rms@gnu.org> writes:

Slawomir identified  that I misstakenly used an old emacs in my tests,
so hopefully this was a false alarm. (I havent been able to rebuild
properly yet)

> Stefan Monnier does a little work on python.el, but I'd say that
> nobody is really maintaining it.  No work has been done recently on
> the indentation.  So you may as well try.

-- 
Joakim Verona

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

end of thread, other threads:[~2006-06-16 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-15 15:09 [joakim@verona.se: pyhon mode indentation problem] Richard Stallman
2006-06-15 16:44 ` Slawomir Nowaczyk
2006-06-15 17:20   ` joakim
2006-06-15 22:37     ` Slawomir Nowaczyk
2006-06-16 15:06   ` Richard Stallman
2006-06-16 16:34     ` joakim

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).