From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: seberino@spawar.navy.mil (Christian Seberino) Newsgroups: gmane.emacs.help Subject: Re: How add "#" to blank lines when using py-comment-region??? Date: 13 Aug 2003 11:15:45 -0700 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1060799496 2132 80.91.224.253 (13 Aug 2003 18:31:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2003 18:31:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 13 20:31:34 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19n0PG-0000fL-00 for ; Wed, 13 Aug 2003 20:31:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19n0OA-0002Sb-Hx for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2003 14:30:26 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-NNTP-Posting-Host: 198.253.71.174 Original-X-Trace: posting.google.com 1060798546 6013 127.0.0.1 (13 Aug 2003 18:15:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 13 Aug 2003 18:15:46 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:115871 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11790 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11790 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 wrote in message news:... > 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.