This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: python-mode.el: py-b-of-def-or-class looks inside strings
Type: Stage:
Components: Demos and Tools Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dhagglund, nnorwitz
Priority: normal Keywords:

Created on 2003-10-26 03:57 by dhagglund, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sample.py dhagglund, 2003-10-26 03:57 file to demonstrate py-beginning-of-def-or-class bug
patch dhagglund, 2003-10-26 05:32 patch to fix this bug.
Messages (4)
msg18761 - (view) Author: Dale Hagglund (dhagglund) Date: 2003-10-26 03:57
Using python-mode.el 4.6 and gnu emacs 21.1.

To demonstrate this problem:

1. Open the attached file with emacs.

2. Position point at the "#" on the last line.

3. Type `M-C-a', py-beginning-of-def-or-class.

Point will now be inside the docstring for class x.

py-b-o-d-o-c uses regexps to look backwards for def or class lines.  When it finds a candidate line, should it maybe use partial-parse-sexp to decide if it's in a string or not?

I apologize if this issue has been raised before, but I wasn't able to figure out how to do keyword searches with sourceforge.
msg18762 - (view) Author: Dale Hagglund (dhagglund) Date: 2003-10-26 05:32
Logged In: YES 
user_id=895011

I guess I should have waited a bit longer before filing this as a bug.  The attached patch resolves this bug for me.

This patch also fixes a minor related bug in py-end-of-def-or-class.  If COUNT was greater than zero, the call to py-beginning-of-def-or-class was incorrect.
msg18763 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-10-27 14:08
Logged In: YES 
user_id=33168

This bug/patch should be submitted to the python-mode
project.  Thanks for the patch!
msg18764 - (view) Author: Dale Hagglund (dhagglund) Date: 2003-11-01 20:41
Logged In: YES 
user_id=895011

Resubmitted to the python-mode project, and closed this one.
History
Date User Action Args
2022-04-11 14:56:00adminsetgithub: 39460
2003-10-26 03:57:39dhagglundcreate