From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: comments in cc mode Date: Sat, 22 May 2010 19:15:40 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: <4ACDABA4.7070402@easy-emacs.de> <803a9456-e1ed-433b-b660-df186b066249@z17g2000vbd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1291833181 18647 80.91.229.12 (8 Dec 2010 18:33:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 18:33:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 19:32:57 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQOoy-0005cF-UE for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 19:32:57 +0100 Original-Received: from localhost ([127.0.0.1]:39105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQOoy-00045n-93 for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 13:32:56 -0500 Original-Path: usenet.stanford.edu!newsserver.news.garr.it!kanaga.switch.ch!switch.ch!news.belwue.de!news.tu-darmstadt.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 67 Original-NNTP-Posting-Host: marvin.muc.de Original-X-Trace: colin2.muc.de 1274555740 90889 2001:608:1000::2 (22 May 2010 19:15:40 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Sat, 22 May 2010 19:15:40 +0000 (UTC) User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386)) Original-Xref: usenet.stanford.edu gnu.emacs.help:178367 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75797 Archived-At: Michael wrote: > Dear Alan, > On May 22, 11:43?am, Alan Mackenzie wrote: >> Hi, Michael, >> "Massmann, M. (Michael)" wrote: >> > Dear Andreas, >> > Many thanks for this. Could you point me to the documentation for the >> > options available for comment-style? After playing around with some of >> > them I did not get the desired effect. >> > I also had a look at cc-mode's `c-indent-comment-alist' and set every >> > single entry to `column' and `nil', so as to have the default column >> > (ie 100) apply, no matter what the surrounding syntax is. The variable >> > `c-indent-comments-syntactically-p' I set to nil so that it does not >> > override the previous settings. >> > This seems to have the desired effect that when I press M-; to insert a >> > *new* comment on a line, empty or not, the comment indeed starts in >> > column 100. >> > Yet when I press M-; to re-align an *existing* comment, the entire >> > comment is moved to a column other than 100 in 9 out of 10 cases. >> > Any advice on how to rectify this problem would be appreciated. Thanks! >> I've just gone through `comment-dwim' in edebug (the Emacs debugger), and >> it seems like comments are being made to fit within `fill-column'. ?I >> don't know why this is being done, but could you try setting it to a high >> value, say >> ? ? (setq fill-column 150) >> . ?Does this solve the immediate problem? ?Does it introduce any new >> problems? >> > Regards, >> > Michael >> -- >> Alan Mackenzie (Nuremberg, Germany). > Many thanks for your suggestion! This was precisely what was going > pear-shaped. I did have my fill-column at 150 to start with, but some > of my comments were more than 50 characters long, and they seem to > have been shifted left such that they ended on column 150. I have now > increased fill-column to 200 and everything works beautifully. > One more question if I may: is there an easy way to tell Emacs to > automatically set fill-column to 200 when in cc-mode and to leave it > at 150 otherwise (eg when loading auctex)? Column 200 is off my screen > and it is only with code comments that this doesn't bother me. The following (not tested) should do it: (setq-default fill-column 150) (defun mm-cc-fill-column () (setq fill-column 200)) (add-hook 'c-mode-common-hook 'mm-cc-fill-column) > Thanks again for your help, No problem. I must say, you've got a MUCH wider screen than I have. ;-) > Michael -- Alan Mackenzie (Nuremberg, Germany).