unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: emacs: indent automatically on c, c++, php comments
Date: Sat, 13 Sep 2003 18:59:54 +0000	[thread overview]
Message-ID: <afpvjb.r5.ln@acm.acm> (raw)
In-Reply-To: pan.2003.09.13.15.38.35.642674@msedv.at

Alex Braumann <ab@msedv.at> 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 <esc> \ (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").

  reply	other threads:[~2003-09-13 18:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-06  9:30 emacs: indent automatically on c, c++, php comments Alex Braumann
2003-09-06 10:37 ` Alan Mackenzie
2003-09-13 12:04   ` Alex Braumann
2003-09-13 13:36     ` Alan Mackenzie
2003-09-13 15:38       ` Alex Braumann
2003-09-13 18:59         ` Alan Mackenzie [this message]
2003-09-14 13:33           ` Alex Braumann
2003-09-15 15:21             ` Stefan Monnier
2003-09-15 19:50               ` Alex Braumann
2003-09-15 20:13                 ` Stefan Monnier
2003-09-17 13:42             ` Alan Mackenzie
2003-09-18  7:44               ` Alex Braumann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afpvjb.r5.ln@acm.acm \
    --to=none@example.invalid \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).