[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C style comments
From: |
Alan Mackenzie |
Subject: |
Re: C style comments |
Date: |
Wed, 18 Feb 2004 19:11:37 +0000 |
User-agent: |
tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) |
Peter Collingbourne <pcc03@doc.ic.ac.uk> wrote on 18 Feb 2004 17:24:53 +0000:
> Hello
> I am new to Emacs and I am trying to get C style comments in Java. I.e.
> /*
> *
> */
> The below .emacs file works when the comment is not indented, but when there
> is an indent before the code I am commenting I get something like this
> /*
> *
> */
> i.e. there is no indent on the lines after the first one. I use M-; to open
> a comment and M-C-j to go the next line.
> Here's my .emacs
> (defun my-indent-setup ()
> (setq c-basic-offset 8)
> (setq indent-tabs-mode t)
> (setq comment-multi-line t)
> (setq comment-start "/*")
> (setq fill-prefix " * ")
> (setq comment-end " */")
> )
> (add-hook 'java-mode-hook 'my-indent-setup)
Remove the `(setq fill-prefix " * ")' from my-indent-setup.
What's happening is that in `c-indent-new-comment-line' (what C-M-j is
bound to) a fill-prefix overrules everything else, and this doesn't get
indented. Incidentally, M-j is also bound to this function, and might be
easier to type. :-)
If you actually need fill-prefix in this buffer for some good reason,
then we'll need to think of another solution.
> Peter
--
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").