From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Newsgroups: gmane.emacs.help Subject: Re: comments in cc mode Date: Sun, 23 May 2010 04:45:17 -0700 (PDT) Organization: http://groups.google.com Message-ID: <50ebd3f1-8301-4300-9a94-7b993d74d8d0@o39g2000vbd.googlegroups.com> References: <4ACDABA4.7070402@easy-emacs.de> <803a9456-e1ed-433b-b660-df186b066249@z17g2000vbd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291834038 23203 80.91.229.12 (8 Dec 2010 18:47:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 18:47:18 +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:47:11 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 1PQP2k-00053p-EH for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 19:47:10 +0100 Original-Received: from localhost ([127.0.0.1]:51643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQP2j-0003WJ-NH for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 13:47:09 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!o39g2000vbd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 71 Original-NNTP-Posting-Host: 93.125.167.94 Original-X-Trace: posting.google.com 1274615118 21614 127.0.0.1 (23 May 2010 11:45:18 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sun, 23 May 2010 11:45:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o39g2000vbd.googlegroups.com; posting-host=93.125.167.94; posting-account=eSv9jAoAAABOki9g4H1AstlVmnvbkn8_ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.9) Gecko/20100317 SUSE/3.5.9-0.1.1 Firefox/3.5.9,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:178372 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:75820 Archived-At: On May 22, 9:15=A0pm, Alan Mackenzie wrote: > 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 th= e > >> > 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 ever= y > >> > single entry to `column' and `nil', so as to have the default column > >> > (ie 100) apply, no matter what the surrounding syntax is. The variab= le > >> > `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 inser= t 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. Than= ks! > >> 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 h= igh > >> 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 () > =A0 (setq fill-column 200)) > (add-hook 'c-mode-common-hook 'mm-cc-fill-column) > > > Thanks again for your help, > > No problem. =A0I must say, you've got a MUCH wider screen than I have. = =A0;-) > > > Michael > > -- > Alan Mackenzie (Nuremberg, Germany). This works like a dream! Thanks, Alan. PS: I would think my screen is standard size, but I do love small fonts!