GNU bug report logs - #19665
25.0.50; python.el: mark defun bug when point is in class statement

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita <at> gmail.com>

Date: Fri, 23 Jan 2015 16:13:02 UTC

Severity: normal

Tags: notabug, patch

Merged with 19748

Fixed in version 25.0.50

Done: fgallina <at> gnu.org (Fabián Ezequiel Gallina)

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 19665 in the body.
You can then email your comments to 19665 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#19665; Package emacs. (Fri, 23 Jan 2015 16:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carlos Pita <carlosjosepita <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 23 Jan 2015 16:13:03 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Subject: 25.0.50; python.el: mark defun bug when point is in class statement
Date: Fri, 23 Jan 2015 13:12:14 -0300
Specifically, try the example below:

```
class A: pass


class B:

    def __init__(self): pass

    def fun(self): pass

class C: pass
```

1) If point is in the line immediately after "class B:", then C-M-h will
select the entire class B definition, as expected.

2) If point is in the line "class B:", then C-M-h will select just the
definition of the fun method, which is entirely unexpected!

Cheers
--
Carlos




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19665; Package emacs. (Fri, 23 Jan 2015 21:19:01 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: 19665 <at> debbugs.gnu.org
Date: Fri, 23 Jan 2015 18:17:58 -0300
It seems to me that the problem is in python-nav--beginning-of-defun.
Specifically there is (< arg 0) guard that is testing the wrong case
(end-of-line should be called for the backwards case, not the forward
one):

        (found
           (progn
-            (when (and (< arg 0)
+            (when (and (> arg 0)
                        (python-info-looking-at-beginning-of-defun))
               (end-of-line 1))
             (while (and (funcall re-search-fn




Added tag(s) patch. Request was from Carlos Pita <carlosjosepita <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 23 Jan 2015 21:19:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19665; Package emacs. (Mon, 02 Feb 2015 19:35:01 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: 19665 <at> debbugs.gnu.org
Cc: Fabian Ezequiel Gallina <galli.87 <at> gmail.com>
Date: Mon, 2 Feb 2015 16:33:32 -0300
[Message part 1 (text/plain, inline)]
Patch updated against current master (954ca0f017f62f52ee679f2aa68effb20c917278).
[mark-defun.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19665; Package emacs. (Mon, 09 Feb 2015 16:47:01 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: 19665 <at> debbugs.gnu.org
Cc: Fabián Ezequiel Gallina <fgallina <at> gnu.org>
Subject: Re: bug#19665: 25.0.50; python.el: mark defun bug when point is in
 class statement
Date: Mon, 9 Feb 2015 13:46:03 -0300
[Message part 1 (text/plain, inline)]
Updated patch, see detailed discussion in

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19748



On Fri, Jan 23, 2015 at 1:13 PM, GNU bug Tracking System
<help-debbugs <at> gnu.org> wrote:
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  bug-gnu-emacs <at> gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 19665 <at> debbugs.gnu.org.
>
> Please do not send mail to help-debbugs <at> gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 19665: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19665
> GNU Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
[mark-defun.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19665; Package emacs. (Mon, 09 Feb 2015 17:38:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: 19665 <at> debbugs.gnu.org
Cc: Fabián Ezequiel Gallina <fgallina <at> gnu.org>
Subject: Re: bug#19665: 25.0.50; python.el: mark defun bug when point is in
 class statement
Date: Mon, 9 Feb 2015 14:36:33 -0300
[Message part 1 (text/plain, inline)]
Here is a variation of the last patch that behaves better when the
point is in empty lines above a defun.

Another entirely different approach to solve this issue without
redefining mark-defun could be to differentiate:

class M:
     def m():
          pass*

and

class M:
   def m():
      pass
*

(where * stands for the point)

In the second case, C-M-h will select the class, while in the first it
will select the method. Then, there would be no need to hack
mark-defun.

What do you think?
[mark-defun.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19665; Package emacs. (Wed, 11 Feb 2015 15:54:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: 19665 <at> debbugs.gnu.org
Cc: Fabián Ezequiel Gallina <fgallina <at> gnu.org>
Subject: Re: bug#19665: 25.0.50; python.el: mark defun bug when point is in
 class statement
Date: Wed, 11 Feb 2015 12:52:35 -0300
Sorry I mistakenly posted the same patch twice. The "when the point is
in empty lines above a defun" concern is addressed by defining
python-mark-defun as follows:

(defun python-mark-defun ()
  (interactive)
  (unless (eq last-command this-command)
    (skip-chars-forward " \t\n")
    (when (python-info-looking-at-beginning-of-defun)
      (end-of-line 1)))
  (mark-defun 1))

Cheers
--
Carlos




Merged 19665 19748. Request was from fgallina <at> gnu.org (Fabián Ezequiel Gallina) to control <at> debbugs.gnu.org. (Thu, 09 Apr 2015 04:08:01 GMT) Full text and rfc822 format available.

Reply sent to fgallina <at> gnu.org (Fabián Ezequiel Gallina):
You have taken responsibility. (Mon, 06 Jul 2015 04:06:03 GMT) Full text and rfc822 format available.

Notification sent to Carlos Pita <carlosjosepita <at> gmail.com>:
bug acknowledged by developer. (Mon, 06 Jul 2015 04:06:04 GMT) Full text and rfc822 format available.

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

From: fgallina <at> gnu.org (Fabián Ezequiel Gallina)
To: 19665-done <at> debbugs.gnu.org
Subject: 25.0.50; python.el: mark defun bug when point is in class statement
Date: Mon, 06 Jul 2015 01:05:37 -0300
Fix pushed at a5e39bf in master.

--
Thanks,
Fabián.




Reply sent to fgallina <at> gnu.org (Fabián Ezequiel Gallina):
You have taken responsibility. (Mon, 06 Jul 2015 04:06:04 GMT) Full text and rfc822 format available.

Notification sent to Carlos Pita <carlosjosepita <at> gmail.com>:
bug acknowledged by developer. (Mon, 06 Jul 2015 04:06:04 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. (Mon, 03 Aug 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 16 days ago.

Previous Next


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