Comments

Fernando Pérez fperez528 at yahoo.com
Thu May 9 17:11:28 EDT 2002


Huaiyu Zhu wrote:

> Fernando Pérez <fperez528 at yahoo.com> wrote:
>>Karl Pflästerer wrote:
>>
>>>> ... Is there a way to make emacs ignore lines that wouldn't be
>>>> considered comments by the language when wrapping?
>>> 
>>> I changed the value of `paragraph-start'. I did it like this:
>>> 
>>> (add-hook 'python-mode-hook
>>>           (lambda ()
>>>               (setq paragraph-start "[ \t\n\f#]")))
>>> 
>>> "[ \t\n\f]" is the default for this variable.
>>> 

>>
>>But this one was a fairly nagging one for me,  so I _greatly_ appreciate
>>your solution (I'm glad I stumled on this thread!)
> 
> Does this really work for you?  After I added this, M-q no longer considers
> multiline comments as a single paragraph.  It also wraps long comment lines
> without adding new # signs.  Maybe I have some other settings in .emacs that
> are interfering with this?

Yes, it works perfectly. Now I can have:

def f():
  """ bla.... long (multiline)"""
  # bla comments, long...

and hit M-q in the commment and the docstring, and they both get independently 
lined up _without_ the surrounding code or eachother getting broken. 
Absolutely perfect!

I used to constantly play the game of 'add whitespace above and below, hit 
M-q, delete whitespace'. So I _really_ like this, and the solution poster has 
earned my eternal gratitude ;)

Cheers,

f.
  



More information about the Python-list mailing list