unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Luca Ferrari <fluca1978@infinito.it>
To: drain <aeuster@gmail.com>
Cc: Help-gnu-emacs@gnu.org
Subject: Re: c-like comments settings
Date: Fri, 4 Jan 2013 08:52:27 +0100	[thread overview]
Message-ID: <CAKoxK+48n2C1u3qyH+byPzV4g17xk8YFCxANkEiY0vx6yNduBw@mail.gmail.com> (raw)
In-Reply-To: <1357274158790-274418.post@n5.nabble.com>

Thanks for help, but I'm not so lisp-expert to understand what I have
to do by myself just reading the documentation, so any other clue is
appreciated. In the meantime I found the "comment-close-slash"
variable that, if added to the cleanup list, should at least close the
comment with a single slash. Unluckily I tried to do the following:

(add-hook 'c-mode-common-hook
          '(lambda ()
             (add-to-list* 'c-cleanup-list
                           'comment-close-slash)))

which does not work, so I'm getting something wrong....

Luca

On Fri, Jan 4, 2013 at 5:35 AM, drain <aeuster@gmail.com> wrote:
> Very lazy hint: take a look at the comment-region source code:
>
> (defun comment-region (beg end &optional arg)
>   "Comment or uncomment each line in the region.
> With just \\[universal-argument] prefix arg, uncomment each line in region
> BEG .. END.
> Numeric prefix ARG means use ARG comment characters.
> If ARG is negative, delete that many comment characters instead.
>
> The strings used as comment starts are built from `comment-start'
> and `comment-padding'; the strings used as comment ends are built
> from `comment-end' and `comment-padding'.
>
> By default, the `comment-start' markers are inserted at the
> current indentation of the region, and comments are terminated on
> each line (even for syntaxes in which newline does not end the
> comment and blank lines do not get comments).  This can be
> changed with `comment-style'."
>   (interactive "*r\nP")
>   (comment-normalize-vars)
>   (if (> beg end) (let (mid) (setq mid beg beg end end mid)))
>   (save-excursion
>     ;; FIXME: maybe we should call uncomment depending on ARG.
>     (funcall comment-region-function beg end arg)))
>
>
>
>
> --
> View this message in context: http://emacs.1067599.n5.nabble.com/c-like-comments-settings-tp274365p274418.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>



      reply	other threads:[~2013-01-04  7:52 UTC|newest]

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

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+48n2C1u3qyH+byPzV4g17xk8YFCxANkEiY0vx6yNduBw@mail.gmail.com \
    --to=fluca1978@infinito.it \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=aeuster@gmail.com \
    /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).