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 13:36:52 +0000	[thread overview]
Message-ID: <kh6vjb.r5.ln@acm.acm> (raw)
In-Reply-To: pan.2003.09.13.12.04.19.139715@msedv.at

Alex Braumann <ab@msedv.at> 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 <alt> or <window> 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").

  reply	other threads:[~2003-09-13 13:36 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 [this message]
2003-09-13 15:38       ` Alex Braumann
2003-09-13 18:59         ` Alan Mackenzie
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=kh6vjb.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).