emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#19748: closed (python.el: navigate to beginning of


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19748: closed (python.el: navigate to beginning of defun gets stucked)
Date: Mon, 06 Jul 2015 04:06:04 +0000

Your message dated Mon, 06 Jul 2015 01:05:37 -0300
with message-id <address@hidden>
and subject line 25.0.50; python.el: mark defun bug when point is in class 
statement
has caused the debbugs.gnu.org bug report #19665,
regarding python.el: navigate to beginning of defun gets stucked
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19665: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19665
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: python.el: navigate to beginning of defun gets stucked Date: Mon, 02 Feb 2015 18:29:39 -0300
This report is for python.el in the current master
(c10828bd8520db83cc06a2ad5de6f8a1ad74b83c).

Pressing C-M-a one time correctly positions the point at the beginning
of the current class or defun statement. Pressing C-M-a multiple times
is futile, as the point gets stucked where the first movement left
it. This is not consistent with the usual emacs behavior and it's not
very convenient to navigate code anyway.

The problem is in python-nav--beginning-of-defun:

            (when (and (> arg 0)
                       (python-info-looking-at-beginning-of-defun))
              (end-of-line 1))

This puts the point at the end of the line when the point is at a defun
or class line and the navigation is backward. So the next
re-search-backward will match the current line. This is fine when the
point is *after* the column where the defun or class statement starts,
but not quite so when the point is *over the indentation* whitespace
(that is, before the beginning of the defun/class keyword).

One simple solution is to add another condition:

            (when (and (> arg 0)
                       (> (current-column) (current-indentation))
                       (python-info-looking-at-beginning-of-defun))
              (end-of-line 1))

diff --git a/.emacs.d/lisp/python.el b/.emacs.d/lisp/python.el
index 788d09f..ca69b68 100644
--- a/.emacs.d/lisp/python.el
+++ b/.emacs.d/lisp/python.el
@@ -1295,6 +1295,7 @@ With positive ARG search backwards, else search forwards."
          (found
           (progn
             (when (and (> arg 0)
+                       (> (current-column) (current-indentation))
                        (python-info-looking-at-beginning-of-defun))
               (end-of-line 1))
             (while (and (funcall re-search-fn

--- End Message ---
--- Begin Message --- Subject: 25.0.50; python.el: mark defun bug when point is in class statement Date: Mon, 06 Jul 2015 01:05:37 -0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5.50 (gnu/linux)
Fix pushed at a5e39bf in master.

--
Thanks,
Fabián.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]