From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Reitter Newsgroups: gmane.emacs.devel Subject: bug in python-guess-indent (python-mode) Date: Fri, 20 Apr 2007 18:13:00 +0100 Message-ID: <291DF2F9-69B3-4CF2-927C-E53C6E7EFDA3@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1177089198 24338 80.91.229.12 (20 Apr 2007 17:13:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Apr 2007 17:13:18 +0000 (UTC) To: emacs- devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 20 19:13:12 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HewfX-0005rF-1s for ged-emacs-devel@m.gmane.org; Fri, 20 Apr 2007 19:13:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hewkb-0004xF-NS for ged-emacs-devel@m.gmane.org; Fri, 20 Apr 2007 13:18:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HewkX-0004xA-Vn for emacs-devel@gnu.org; Fri, 20 Apr 2007 13:18:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HewkW-0004wx-EQ for emacs-devel@gnu.org; Fri, 20 Apr 2007 13:18:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HewkW-0004wu-Br for emacs-devel@gnu.org; Fri, 20 Apr 2007 13:18:20 -0400 Original-Received: from ug-out-1314.google.com ([66.249.92.175]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HewfQ-00049g-Q5 for emacs-devel@gnu.org; Fri, 20 Apr 2007 13:13:04 -0400 Original-Received: by ug-out-1314.google.com with SMTP id j3so930964ugf for ; Fri, 20 Apr 2007 10:13:03 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=BRvgYvO1t20ef630kCJAfdsutolqprFdWJcVjAciQQfb8KM2h/yuAPWJ2gyRHST6VAJA96VMs2VefDA/hjvGvo3KSGYmEB4fm+iSfVRQWPXA7jZH/dorEZa8SFGy7g88UqNlRbBOTeWbZNR4r8DMowJiqkZvf1cwWbtK57AXOnM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=j4ghyx6R9yr1EeFTxY0NX5g5haS+PEV43H/nWRr2PI+YMg3SgCfsozS0fPnbWyrAX88zRy+9jhKfnovsLgQ72b0+oZAD/cWfswlru8NnU1fjB7HJ8SBYvTpSVd/9+xIVuXGhYcRqPU4AK359GPoV6PPxZnAp5Yo0qfRwhvb4z74= Original-Received: by 10.67.100.10 with SMTP id c10mr2956174ugm.1177089183472; Fri, 20 Apr 2007 10:13:03 -0700 (PDT) Original-Received: from ?129.215.174.81? ( [129.215.174.81]) by mx.google.com with ESMTP id 32sm6884449ugf.2007.04.20.10.13.02; Fri, 20 Apr 2007 10:13:02 -0700 (PDT) X-Mailer: Apple Mail (2.752.2) X-detected-kernel: Linux 2.4-2.6 (Google crawlbot) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69706 Archived-At: 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))