unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
To: emacs- devel <emacs-devel@gnu.org>
Subject: bug in python-guess-indent (python-mode)
Date: Fri, 20 Apr 2007 18:13:00 +0100	[thread overview]
Message-ID: <291DF2F9-69B3-4CF2-927C-E53C6E7EFDA3@gmail.com> (raw)

There is a bug that brings up an `wrong type argument' error in  
`python-guess-indent' when doing M-x python-mode in situations where  
there is little actual indentation in the buffer, such as when the  
buffer just contains a line like this:

for line in IN:

A simple fix for the problem is attached. (It will cause `python- 
guess-indent' not to set the indentation variable locally in such a  
case.)



PS.: Sorry if my mail client wraps lines diffs. I have no control  
over this. Please apply manually in case that happens.


Index: python.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.57
diff -c -r1.57 python.el
*** lisp/progmodes/python.el	28 Mar 2007 01:21:46 -0000	1.57
--- lisp/progmodes/python.el	20 Apr 2007 17:06:13 -0000
***************
*** 461,467 ****
   	      (let ((initial (current-indentation)))
   		(if (zerop (python-next-statement))
   		    (setq indent (- (current-indentation) initial)))
! 		(if (and (>= indent 2) (<= indent 8)) ; sanity check
   		    (setq done t))))))
   	(when done
   	  (when (/= indent (default-value 'python-indent))
--- 461,467 ----
   	      (let ((initial (current-indentation)))
   		(if (zerop (python-next-statement))
   		    (setq indent (- (current-indentation) initial)))
! 		(if (and indent (>= indent 2) (<= indent 8)) ; sanity check
   		    (setq done t))))))
   	(when done
   	  (when (/= indent (default-value 'python-indent))

             reply	other threads:[~2007-04-20 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20 17:13 David Reitter [this message]
2007-05-08  1:35 ` bug in python-guess-indent (python-mode) Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=291DF2F9-69B3-4CF2-927C-E53C6E7EFDA3@gmail.com \
    --to=david.reitter@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).