[Top][All Lists]

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

[debbugs-tracker] bug#14352: closed (24.3; Python: narrow-to-defun narro

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14352: closed (24.3; Python: narrow-to-defun narrows to class, not method)
Date: Wed, 25 Dec 2013 20:09:01 +0000

Your message dated Wed, 25 Dec 2013 17:07:30 -0300
with message-id <address@hidden>
and subject line 
has caused the debbugs.gnu.org bug report #14352,
regarding 24.3; Python: narrow-to-defun narrows to class, not method
to be marked as done.

(If you believe you have received this mail in error, please contact

14352: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14352
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3; Python: narrow-to-defun narrows to class, not method Date: Sun, 5 May 2013 10:43:05 -0700
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.

# Hello world

class Frotz(object):

    def meth(self):
        foo = 'bar'

    def seth(self):

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

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> 

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

(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

--- End Message ---
--- Begin Message --- Subject: Date: Wed, 25 Dec 2013 17:07:30 -0300 User-agent: mu4e; emacs 24.3.1
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."
        (end-of-line 1)


--- End Message ---

reply via email to

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