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 13:36:52 +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 1063468072 6576 80.91.224.253 (13 Sep 2003 15:47:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Sep 2003 15:47:52 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 13 17:47:50 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 19yCco-0000vi-00 for ; Sat, 13 Sep 2003 17:47:50 +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 19yCbr-0007ac-He for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Sep 2003 11:46:51 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!usenet-fr.net!mephistopheles.news.clara.net!news.clara.net!newsfeed01.sul.t-online.de!t-online.de!easynews.net!newsfeed3.easynews.net!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1063466533 18344 193.149.49.134 (13 Sep 2003 15:22:13 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 13 Sep 2003 15:22:13 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:116584 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:12505 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12505 Alex Braumann wrote on Sat, 13 Sep 2003 12:04:19 GMT: > On Sat, 06 Sep 2003 10:37:40 +0000, Alan Mackenzie wrote: > I'm using PHP Mode at the moment. >> Instead of typing '//', use M-; (that is, press the semicolon key >> whilst holding the Meta key (probably the or key). >> This will then insert the '//' at comment-column, which is by default >> 32. > M- (alt + ;) produces '//' at column 0! > That's my problem and I don't know how to fix it -> that '//' will appear > on line 32; > This doens't work, unfortunately. > (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!] > Is it possible that php-mode doens't know comment-column?? No, comment-column is part of the Emacs base itself. (Note: variables which are part of a package have a prefix indicating this: If current-column had belonged to CC Mode, it would have been called "c-comment-column"). > Well, as I said, I'm an emacs-rookie. Keep learning, keep having fun! > tc, > alex. -- 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").