GNU bug report logs - #12822
python.el, python-indent-guess-indent-offset

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Wed, 7 Nov 2012 11:06:01 UTC

Severity: minor

Tags: wontfix

Done: Fabián Ezequiel Gallina <fabian <at> anue.biz>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12822 in the body.
You can then email your comments to 12822 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12822; Package emacs. (Wed, 07 Nov 2012 11:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 07 Nov 2012 11:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: python.el, python-indent-guess-indent-offset
Date: Wed, 07 Nov 2012 12:05:13 +0100
Hi,

with current python.el

python-indent-guess-indent-offset proceeds:

(defun python-indent-guess-indent-offset ()
  "Guess and set `python-indent-offset' for the current buffer."
  (interactive)
  (save-excursion
    (save-restriction
      (widen)
      (goto-char (point-min))
      (let ((block-end))
        (while (and (not block-end)
                    (re-search-forward
                     (python-rx line-start block-start) nil t))
                     [...]


IIUC it fetches the first beginning of block in buffer.
As in Python every block might have it's own ideas WRT
volume of indent-step, this must fail when
indent-offset is set differently in current block.

Guessing must not take the first block from BOB, but
the next beginning of block from point upward.

IMO as it's just a guess, where the default-value might
be delivered, it also should not call `widen'.

Best,

Andreas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12822; Package emacs. (Thu, 24 Jan 2013 01:41:03 GMT) Full text and rfc822 format available.

Message #8 received at 12822 <at> debbugs.gnu.org (full text, mbox):

From: Fabián Ezequiel Gallina <fabian <at> anue.biz>
To: 12822 <at> debbugs.gnu.org
Date: Wed, 23 Jan 2013 22:40:45 -0300
The whole idea of python-indent-guess-indent-offset is to provide some 
sane default at find-file. The decision of making the indentation of 
first available block the default indentation is intended and it's not 
going to change. This way indentation guessing behaves consistently all 
the time and the user is able to modify the first block so the command 
plays nice to him after next file visit.

Also, as a side note, all blocks in a python file should be indented the 
same way, the only special case would be an if triggered into multiple 
lines using parens like this but this case is not that common that I'm 
not even worrying about:

    if (something and
        somethingelse and
        otherstuff):
            pass





Added tag(s) wontfix. Request was from Fabián Ezequiel Gallina <fabian <at> anue.biz> to control <at> debbugs.gnu.org. (Thu, 24 Jan 2013 01:45:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 12822 <at> debbugs.gnu.org and Andreas Röhler <andreas.roehler <at> easy-emacs.de> Request was from Fabián Ezequiel Gallina <fabian <at> anue.biz> to control <at> debbugs.gnu.org. (Thu, 24 Jan 2013 01:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Feb 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.