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, 6 Sep 2003 10:37:40 +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 1062846415 3685 80.91.224.253 (6 Sep 2003 11:06:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 Sep 2003 11:06:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 06 13:06:53 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 19vau5-0004Vr-00 for ; Sat, 06 Sep 2003 13:06:53 +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 19vatX-0001Zr-9h for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Sep 2003 07:06:19 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1062845224 93317 193.149.49.134 (6 Sep 2003 10:47:04 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 6 Sep 2003 10:47:04 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:116408 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:12327 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12327 Alex Braumann wrote on Sat, 06 Sep 2003 09:30:47 GMT: > Hi, > I am not familiar with all the functions provided by this wonderful > editor, also the configuration is not a task for 5 minutes :). > I have a simple need: > If I type a '//' in my emacs, the cursor should jump to column number 30. You're using C++ Mode, right? > Is this practicable via the .emacs file in my home dir? In essence, yes. 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. (if there's room on the line, that is. If you've already got a long statement on the line, M-; does the Right Thing). You can also use M-; to tidy up existing comments which have got ragged. If you really, truly, absolutely want your comments at column 30 and not 32, change the value of comment-column in your C++ Mode hook. If your reaction to that is "My WHAT??", then the C++ Mode hook is that bit of code, written by you, which gets executed each time a C++ buffer is loaded. Put the following into your .emacs: (defun my-c++-mode-hook () (setq comment-column 30)) (add-hook 'c++-mode-hook 'my-c++-mode-hook) Hook functions (like my-c++-mode-hook) typically contain personal settings for indentation style, tab width, and so on. You can read all about this in the CC Mode manual: C-h i, select CC Mode, then select the page "Sample .emacs File". > thanks! :) > 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").