From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: emacs: indent automatically on c, c++, php comments Date: Sat, 13 Sep 2003 18:59:54 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1063484250 28809 80.91.224.253 (13 Sep 2003 20:17:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Sep 2003 20:17:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 13 22:17:28 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 19yGpk-0001nG-00 for ; Sat, 13 Sep 2003 22:17:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19yGoT-0001gS-54 for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Sep 2003 16:16:09 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!news-FFM2.ecrc.net!news.netplace.de!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1063482870 29674 193.149.49.134 (13 Sep 2003 19:54:30 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 13 Sep 2003 19:54:30 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:116586 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:12507 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12507 Alex Braumann wrote on Sat, 13 Sep 2003 15:38:38 GMT: > On Sat, 13 Sep 2003 13:36:52 +0000, Alan Mackenzie wrote: >>> (defun my-php-mode-hook ( ) >>> (setq comment-column 30)) >>> (add-hook 'c++-mode-hook 'my-php-mode-hook) >> It's your third line that's at fault. >> (add-hook 'c++-mode-hook 'my-php-mode-hook) says "Add the function >> my-php-mode-hook to the list of functions which is called whenever C++ >> MODE is started." >> Replace "c++-mode-hook" with "php-mode-hook", giving this: (add-hook >> 'php-mode-hook 'my-php-mode-hook) >> [Or, if you'd already written that and merely made a typo when composing >> your article (it happens to the best of us) come back again!] > It has been a typo :) > so, here I am! Hi, there! I've actually loaded up the mode and tried it out. I should have done this earlier. :-( What I see is that M-; on a _blank_ line leaves the "//" at column zero. On a non-blank line (even if it's only got a single space), the "//" does indeed go to column 32 (or 30). So if you want a comment at C30 on an otherwise blank line, type a single space followed by M-; If you have a line with a comment at C0, and you want to reallign it to C30, type a single space at the start of the line, followed by M-; . This will move the existing comment rather than creating a silly "second comment" on the line. Finally, a useful command if you've got a comment at C30 but you really wanted it at C0 is M-\ 'delete-horizontal-space', which does what it says. [Yes, I know M-\ is awkward to type on a German keyboard layout. You can use \ (two separate key actions) instead.] Hope all this works as described and does what you want. If not, come back yet again! -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").