From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carlos Pita Newsgroups: gmane.emacs.bugs Subject: bug#18796: Date: Wed, 22 Oct 2014 15:11:24 -0300 Message-ID: References: <82d29k3v37.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1414001612 6689 80.91.229.3 (22 Oct 2014 18:13:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Oct 2014 18:13:32 +0000 (UTC) Cc: fabian@anue.biz To: 18796@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 22 20:13:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xh0PR-0007Dy-N9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Oct 2014 20:13:21 +0200 Original-Received: from localhost ([::1]:59661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh0PR-0005Sz-3K for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Oct 2014 14:13:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh0OG-0004gG-Lo for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 14:12:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xh0OA-0002D8-Bl for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 14:12:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh0OA-0002D4-8X for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 14:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xh0O9-0006kl-Sd for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 14:12:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <82d29k3v37.fsf@gmail.com> Resent-From: Carlos Pita Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Oct 2014 18:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18796 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18796-submit@debbugs.gnu.org id=B18796.141400151325943 (code B ref 18796); Wed, 22 Oct 2014 18:12:01 +0000 Original-Received: (at 18796) by debbugs.gnu.org; 22 Oct 2014 18:11:53 +0000 Original-Received: from localhost ([127.0.0.1]:60203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xh0O1-0006kN-4Y for submit@debbugs.gnu.org; Wed, 22 Oct 2014 14:11:53 -0400 Original-Received: from mail-lb0-f179.google.com ([209.85.217.179]:50615) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xh0Ny-0006k9-TQ for 18796@debbugs.gnu.org; Wed, 22 Oct 2014 14:11:51 -0400 Original-Received: by mail-lb0-f179.google.com with SMTP id l4so3308417lbv.38 for <18796@debbugs.gnu.org>; Wed, 22 Oct 2014 11:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=CAmZ5NkIcArpgCjobxQOzrfaG7qv7pjiD03OMTq7quU=; b=NtQ9HmY6O+QIJTVG7co4jIxXVmiVoFaA83tYb9Ydrhut6OjxhlMoDwG4ecC4grDu6t WqZJw7GqilxLJm+z/ExWUPGM1CDjyA0oDf1e2TAitUuVE0BaKjhYyerr6rgYkUxY0/2J C0qaY5/xHriC5rr2/CziZUMiqb6IqeNvyWI+OOkLz4y064Q7iFJcD+1VdywgXNFcNppf GMITKHrEQuEKDcNkY1ADxwEj0P334I+itRjsydceKCm7MxjxcpTI5EruIIhVaM55Kh6g syP6InceMaAUth1S9cc5orsy3VqVGe35Dg8H4ULtdrWV/xvmCKFJCF00qKXHK8ThelRd FvgQ== X-Received: by 10.152.36.230 with SMTP id t6mr4552158laj.88.1414001504554; Wed, 22 Oct 2014 11:11:44 -0700 (PDT) Original-Received: by 10.112.252.101 with HTTP; Wed, 22 Oct 2014 11:11:24 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94943 I've doing some debugging. I found out why the bug happens, but I still have to think of a way to fix it: Say you are in a dedenter line like "else:". In python-indent-region delete-horizontal-space gets executed, so the dedenter "else:" moves to the first column and the current indentation becomes 0. Now python-info-dedenter-opening-block-position initializes indentation as the value returned by (current-indentation), that is 0. Then the opening block position is calculated and the following code gets executed: (if (<= (current-indentation) indentation) (setq position (car positions)) (setq positions (cdr positions))))) In this code (current-indentation) returns the indentation of the opening block, which is fine. But it gets compared to indentation, which is always 0. So the else branch is taken every time and positions is set to nil (cdr positions). Obviously the problem is that at the point python-info-dedenter-opening-block-position is called the original dedenter indentation was lost. Maybe the original indentation should be saved as a dynamic variable before deleting the horizontal space. Or the horizontal space shouldn't be deleted at all and indentation should happen as a displacement from the original position instead of a displacement from the left margin.