unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Luca Ferrari <fluca1978@infinito.it>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: c-like comments settings
Date: Thu, 3 Jan 2013 20:45:27 +0100	[thread overview]
Message-ID: <CAKoxK+4fsG67n0bA7T-eXBp0Zry8VSa6kBHQUkY82PA+srUVHw@mail.gmail.com> (raw)

Hi all,
this is surely trivial but I don't know how to do it. I'd like to know
if it is possible to configure the comments (M-;) in c and c-based
modes (e.g. php) to do the following:

1) if a comment is started on a blank line to open it with a
decorator, so that the following

    /* here-the-cursor */

becomes like the following:

   /*
    * here-the-cursor
    */

but keeping the normal commenting for code lines as follows:

   int my_variable:  /* here the cursor within comment with no decorators */

2) to indent comments so that are all aligned depending on the
rightmost one, so that the following:

    int a_very_long_variable_name = 0; /* comment 1 */
    int i = 2; /* comment */

becomes like the following:

    int a_very_long_variable_name = 0; /* comment 1 */
    int i = 2;                                             /* comment */

3) if it is possible to activate a kind of electric "/" when editing a
comment so that a "/" on an empty line will automatically
close the comment so that the following:

/*
 * blah
 * blah
 * /

is translated to

/*
 * blah
 * blah
 */

Any hint is appreciated.

Thanks,
Luca



             reply	other threads:[~2013-01-03 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 19:45 Luca Ferrari [this message]
2013-01-04  4:35 ` c-like comments settings drain
2013-01-04  7:52   ` Luca Ferrari

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=CAKoxK+4fsG67n0bA7T-eXBp0Zry8VSa6kBHQUkY82PA+srUVHw@mail.gmail.com \
    --to=fluca1978@infinito.it \
    --cc=help-gnu-emacs@gnu.org \
    /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).