help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How add "#" to blank lines when using py-comment-region???


From: Christian Seberino
Subject: Re: How add "#" to blank lines when using py-comment-region???
Date: 13 Aug 2003 11:15:45 -0700

Lawrence

Thanks for the help.  comment-region is a powerful command useful in
all languages!  I tried to set comment-empty-lines but could not
get blank lines to get commented.

Here is a small .emacs I made to try to comment empty lines when
I do a comment-region command.  It works except for blank lines
in C...

   (setq-default auto-mode-alist
      '(("\\.c\\'"    . c-mode      )
        ("\\.h\\'"    . c-mode      ) ))

   (add-hook 'c-mode-hook 'my-c-mode-hook )

   (defun my-c-mode-hook()
      (turn-on-font-lock)
      (setq comment-empty-lines t) )


What am I doing wrong?
Thanks!

Chris 


lawrence mitchell <wence@gmx.li> wrote in message 
news:<?fnord?u1xvqaaba.fsf@ID-97657.usr.dfncis.de>...
> Christian Seberino wrote:
> 
> > py-comment-region lets me
> > add "#" at beginning of non-blank lines that I have
> > highlighted with mouse.
>  
> > It does not add "#" for the blank lines.
>  
> > How can I modify behavior of py-comment-region to do this?
> 
> py-comment-region is just a minor wrapper around comment-region,
> so the variable you want to look at is comment-empty-lines.
> 
> If you only want to comment blank lines in python mode, you'll
> have to make comment-empty-lines buffer local and set it in a
> hook.


reply via email to

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