GNU bug report logs -
#14352
24.3; Python: narrow-to-defun narrows to class, not method
Previous Next
Reported by: Eric Hanchrow <eric.hanchrow <at> gmail.com>
Date: Sun, 5 May 2013 17:45:01 UTC
Severity: normal
Found in version 24.3
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 14352 in the body.
You can then email your comments to 14352 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#14352
; Package
emacs
.
(Sun, 05 May 2013 17:45:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eric Hanchrow <eric.hanchrow <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 05 May 2013 17:45:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org. Please check that
the From: line contains a valid email address. After a delay of up
to one day, you should receive an acknowledgment at that address.
Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.
Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug. If you can, give a recipe
starting from `emacs -Q':
Put the following python program into a file named /tmp/repro.py. It
should have 9 lines and 120 characters.
==>8====>8====>8====>8====>8====>8====>8====>8====>8====>8====>8====>8==
# Hello world
class Frotz(object):
def meth(self):
foo = 'bar'
def seth(self):
znort='frotz'
==8<====8<====8<====8<====8<====8<====8<====8<====8<====8<====8<====8<==
Start emacs with "emacs -Q".
C-x C-f /tmp/repro.py RET
M-x goto-line RET 5 RET
C-x n d
I see almost the entire file -- only the first two lines have been
hidden by narrowing. I'd have expected to see only the two lines
starting with "def meth".
In GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2013-03-12 on bob.porkrind.org
Windowing system distributor `Apple', version 10.3.1187
Configured using:
`configure '--host=x86_64-apple-darwin' '--build=i686-apple-darwin'
'--with-ns' 'build_alias=i686-apple-darwin'
'host_alias=x86_64-apple-darwin' 'CC=gcc -mmacosx-version-min=10.7
-isystem
/Users/david/Xcode-10.7_4.5.2/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/
-F/Users/david/Xcode-10.7_4.5.2/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks''
Important settings:
locale-coding-system: nil
default enable-multibyte-characters: t
Major mode: Python
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-x C-f / t m p / r e p <tab> <return> C-u C-n C-u
C-n C-n C-n C-n C-x n d M-x r e p o r t - e m <tab>
<return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils python rx easymenu comint ring ansi-color
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)
[Message part 2 (text/html, inline)]
Reply sent
to
fgallina <at> gnu.org (Fabián Ezequiel Gallina)
:
You have taken responsibility.
(Wed, 25 Dec 2013 20:09:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Eric Hanchrow <eric.hanchrow <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 25 Dec 2013 20:09:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 14352-done <at> debbugs.gnu.org (full text, mbox):
Unfortunately, this seems like intended behavior (and I do agree that I
don't like it either). I suggest you raise this to emacs-devel if you
really want to change default behavior.
Check the `mark-defun' definition at
emacs/trunk/lisp/emacs-lisp/lisp.el:427 and you'll see that it does have
an explicit call to `beginning-of-defun' for "languages with nested
functions... e.g. Python."
A similar approach seems to takes place in `narrow-to-defun' at
emacs/trunk/lisp/emacs-lisp/lisp.el:470 which causes this.
From my side I've been narrowing defuns by calling `end-of-line' first
if I'm looking at it. You could rebind the `narrow-to-defun' command in
the `python-mode-map' to the following command:
(defun python-narrow-to-defun (&optional _arg)
"Make text outside current defun invisible.
The defun visible is the one that contains point or follows
point. Optional ARG is ignored."
(interactive)
(save-excursion
(end-of-line 1)
(narrow-to-defun)))
Regards,
Fabián.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 23 Jan 2014 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 234 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.