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.
Full log
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.
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.