all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* python mode M-q fills code
@ 2002-07-27  1:36 Tom Tromey
  2002-07-28  2:42 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-07-27  1:36 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-04-08 on porky.devel.redhat.com
configured using `configure  i386-redhat-linux --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-gcc --with-pop --with-sound'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.iso885915
  locale-coding-system: iso-latin-9
  default-enable-multibyte-characters: nil

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I'd like it if M-q consistently and usefully filled comments across
all programming modes.

Right now in Python mode it does not.  Here is how to see the problem:

Open a new Python buffer.  C-x C-f /tmp/q.py
Enter a comment and then some code, like this:

# This is a comment.
# This is the second line of the comment.
class q:

Now move point to the first line and type M-q.
I see this result:

# This is a comment.  This is the second line of the comment.  class
# q:

I would much prefer to see this result:

# This is a comment.  This is the second line of the comment.
class q:

I can accomplish this by temporarily adding an empty line after the
command, filling, and then removing the empty line.  However, this is
a lot of work.  I think it would make sense if filling worked this way
automatically in programming modes.  The idea is that if point is in a
comment, then the boundaries of the comment should be found and
filled.

(Perhaps this is already the standard.  I haven't kept up with
developments in this area.)

I note that perl-mode also has this same problem.  tcl-mode, however,
does not.


As a further refinement, it would be nice if paragraph boundaries in
comments were respected.  For instance filling would stop at a blank
line within the comment.


Recent input:
<backspace> y : <return> s e l f . l o c k . r e l 
e a s e SPC ( ) C-f <return> C-f M-\ C-x C-s <down-mouse-1> 
<mouse-1> s e l f . C-x C-s C-p C-p C-n M-b M-b <M-backspace> 
<M-backspace> <M-backspace> <M-backspace> <M-backspace> 
C-e SPC <backspace> M-q C-/ C-o C-a C-p C-p C-o C-n 
M-q C-p C-k M-} C-k C-x C-s C-h k M-q C-x 1 M-x s e 
n d - b u <backspace> <backspace> e m <tab> <M-backspace> 
<M-backspace> r e p o r t - m <backspace> e m <tab> 
<return>

Recent messages:
call-interactively: End of buffer
Wrote /home/tromey/projects/build/Build/File.py
Mark set
Closes block: ...try:
call-interactively: End of buffer [2 times]
Wrote /home/tromey/projects/build/Build/File.py [2 times]
Undo!
Wrote /home/tromey/projects/build/Build/File.py
Type C-x 1 to remove help window.  C-M-v to scroll the help.
Loading emacsbug...done

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python mode M-q fills code
  2002-07-27  1:36 python mode M-q fills code Tom Tromey
@ 2002-07-28  2:42 ` Richard Stallman
  2002-08-12 22:17   ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2002-07-28  2:42 UTC (permalink / raw)
  Cc: emacs-devel

    # This is a comment.
    # This is the second line of the comment.
    class q:

    Now move point to the first line and type M-q.
    I see this result:

    # This is a comment.  This is the second line of the comment.  class
    # q:

That is indeed a bug.  Python mode does not seem to be part of Emacs.
Where did you find it?

As for Perl mode, this can be fixed by adapting the function
lisp-fill-paragraph or tcl-do-fill-paragraph to Perl syntax, and
making that the local value of fill-paragraph-function in Perl mode.
I don't know Perl; does someone who knows Perl want to work on this?

What about CPerl mode?  Does it do the job right?

    Right now the `_' character seems to have word syntax in python-mode.
    M-f and M-b don't stop at an underscore.

    I thought the standard in Emacs was that `_' ought to have "symbol
    constituent" syntax.

Yes, that's correct.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python mode M-q fills code
  2002-07-28  2:42 ` Richard Stallman
@ 2002-08-12 22:17   ` Tom Tromey
  2002-08-13 20:49     ` Alex Schroeder
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-08-12 22:17 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "rms" == Richard Stallman <rms@gnu.org> writes:

rms> That is indeed a bug.  Python mode does not seem to be part of
rms> Emacs.  Where did you find it?

Apologies; I had assumed it came with GNU Emacs, but now I see it is
actually in site-lisp/ and hence probably comes from some other
source.  I'll try to find out where it comes from.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python mode M-q fills code
  2002-08-12 22:17   ` Tom Tromey
@ 2002-08-13 20:49     ` Alex Schroeder
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Schroeder @ 2002-08-13 20:49 UTC (permalink / raw)
  Cc: emacs-devel

Tom Tromey <tromey@redhat.com> writes:

> Apologies; I had assumed it came with GNU Emacs, but now I see it is
> actually in site-lisp/ and hence probably comes from some other
> source.  I'll try to find out where it comes from.

It is distributed with Python and can be downloaded from their web
site.

Alex.
-- 
http://www.electronicintifada.net/diaries/index.html
http://www.us-israel.org/jsource/US-Israel/hr2506c.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-13 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-27  1:36 python mode M-q fills code Tom Tromey
2002-07-28  2:42 ` Richard Stallman
2002-08-12 22:17   ` Tom Tromey
2002-08-13 20:49     ` Alex Schroeder

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.