GNU bug report logs - #15137
python mode patch

Previous Next

Package: emacs;

Reported by: Daniel Elliott <danelliottster <at> gmail.com>

Date: Mon, 19 Aug 2013 21:53:02 UTC

Severity: minor

Tags: patch

Merged with 15400

Done: fgallina <at> gnu.org

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 15137 in the body.
You can then email your comments to 15137 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#15137; Package emacs. (Mon, 19 Aug 2013 21:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Elliott <danelliottster <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Aug 2013 21:53:02 GMT) Full text and rfc822 format available.

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

From: Daniel Elliott <danelliottster <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: python mode patch
Date: Mon, 19 Aug 2013 16:25:36 -0500
Hello,

I'm submitting a patch that has been tremendously helpful to me.
Please consider this for addition into the next release of the world's
most excellent editor.

2013-08-19  Dan Elliott  <danelliottster <at> gmail.com>

        * progmodes/python.el (python-shell-send-region): added fix
suggested by Barry Warsaw for python-mode.el to fix unexpected
indentation error w\
hen sending region to interpreter



=== modified file 'lisp/progmodes/python.el'
*** lisp/progmodes/python.el    2013-08-16 05:15:51 +0000
--- lisp/progmodes/python.el    2013-08-19 21:14:34 +0000
*************** Returns the output.  See `python-shell-s
*** 2128,2134 ****
        ;; When sending a region, add blank lines for non sent code so
        ;; backtraces remain correct.
        (make-string (1- line-num) ?\n))
!     (buffer-substring start end))
     nil t))

  (defun python-shell-send-buffer (&optional arg)
--- 2128,2137 ----
        ;; When sending a region, add blank lines for non sent code so
        ;; backtraces remain correct.
        (make-string (1- line-num) ?\n))
!     ;; wrap with a conditional to avoid errors about python
unexpected indentation
!     "if True:\n"
!     (buffer-substring start end)
!     "\n")
     nil t))

  (defun python-shell-send-buffer (&optional arg)

Thank you for all of your hard work.

- dan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15137; Package emacs. (Tue, 27 Aug 2013 01:55:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Elliott <danelliottster <at> gmail.com>, Fabián
 E. Gallina <fabian <at> anue.biz>
Cc: 15137 <at> debbugs.gnu.org
Subject: Re: bug#15137: python mode patch
Date: Mon, 26 Aug 2013 21:54:42 -0400
> !     (buffer-substring start end))
[...]
> !     ;; wrap with a conditional to avoid errors about python unexpected indentation
> !     "if True:\n"
> !     (buffer-substring start end)
> !     "\n")

That looks pretty good, thank you.
Fabián, could you take a look?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15137; Package emacs. (Sat, 31 Aug 2013 12:45:02 GMT) Full text and rfc822 format available.

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

From: fabian <at> anue.biz
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Daniel Elliott <danelliottster <at> gmail.com>,
 Fabián E. Gallina <fabian <at> gnu.org>,
 15137 <at> debbugs.gnu.org
Subject: Re: bug#15137: python mode patch
Date: Sat, 31 Aug 2013 09:44:43 -0300
monnier <at> iro.umontreal.ca writes:

>> !     (buffer-substring start end))
> [...]
>> !     ;; wrap with a conditional to avoid errors about python unexpected indentation
>> !     "if True:\n"
>> !     (buffer-substring start end)
>> !     "\n")
>
> That looks pretty good, thank you.
> Fabián, could you take a look?
>

The idea is good but the patch needs bit more of work -- this approach
will work when an indented region is sent but won't when sending a
region which starts with no indentation at all. Also backtraces numbers
will be wrong for a -1 offset.

I'll push something for this soon.


Regards,
Fabián.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15137; Package emacs. (Sun, 01 Sep 2013 07:24:01 GMT) Full text and rfc822 format available.

Message #14 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: Re: bug#15137: python mode patch
Date: Sun, 01 Sep 2013 09:25:13 +0200
Am 31.08.2013 14:44, schrieb fabian <at> anue.biz:
>
> monnier <at> iro.umontreal.ca writes:
>
>>> !     (buffer-substring start end))
>> [...]
>>> !     ;; wrap with a conditional to avoid errors about python unexpected indentation
>>> !     "if True:\n"
>>> !     (buffer-substring start end)
>>> !     "\n")
>>
>> That looks pretty good, thank you.
>> Fabián, could you take a look?
>>
>
> The idea is good but the patch needs bit more of work -- this approach
> will work when an indented region is sent but won't when sending a
> region which starts with no indentation at all.

Right. Current python-mode.el shifts region-or-whatever-delivered left until it starts at column 0.

> Also backtraces numbers
> will be wrong for a -1 offset.
>

Correct. BTW there is still the Emacs count-lines bug: at BOL it counts one less than from secoond column.


> I'll push something for this soon.
>
>
> Regards,
> Fabián.
>
>
>
>





Reply sent to fgallina <at> gnu.org:
You have taken responsibility. (Mon, 02 Sep 2013 14:17:02 GMT) Full text and rfc822 format available.

Notification sent to Daniel Elliott <danelliottster <at> gmail.com>:
bug acknowledged by developer. (Mon, 02 Sep 2013 14:17:03 GMT) Full text and rfc822 format available.

Message #19 received at 15137-done <at> debbugs.gnu.org (full text, mbox):

From: fgallina <at> gnu.org
To: 15137-done <at> debbugs.gnu.org
Subject: python mode patch
Date: Mon, 02 Sep 2013 11:16:29 -0300
Solved this in revno 114108.


Regards,
Fabián.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15137; Package emacs. (Mon, 09 Sep 2013 14:17:03 GMT) Full text and rfc822 format available.

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

From: Daniel Elliott <danelliottster <at> gmail.com>
To: fabian <at> anue.biz
Cc: Fabián E. Gallina <fabian <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 15137 <at> debbugs.gnu.org
Subject: Re: bug#15137: python mode patch
Date: Mon, 9 Sep 2013 09:15:27 -0500
Fabian,

You are correct on both counts.  Please let me know if I can be of
assistance to you.  Thanks for your time and effort.

- dan

On Sat, Aug 31, 2013 at 7:44 AM,  <fabian <at> anue.biz> wrote:
>
> monnier <at> iro.umontreal.ca writes:
>
>>> !     (buffer-substring start end))
>> [...]
>>> !     ;; wrap with a conditional to avoid errors about python unexpected indentation
>>> !     "if True:\n"
>>> !     (buffer-substring start end)
>>> !     "\n")
>>
>> That looks pretty good, thank you.
>> Fabián, could you take a look?
>>
>
> The idea is good but the patch needs bit more of work -- this approach
> will work when an indented region is sent but won't when sending a
> region which starts with no indentation at all. Also backtraces numbers
> will be wrong for a -1 offset.
>
> I'll push something for this soon.
>
>
> Regards,
> Fabián.




Forcibly Merged 15137 15400. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 17 Sep 2013 15:58: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. (Wed, 16 Oct 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 250 days ago.

Previous Next


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