unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Subject: Re: Local Variables question: c-file-style and c-doc-comment-style
Date: Wed, 17 Jan 2007 23:21:09 -0700	[thread overview]
Message-ID: <eon3kb$ifb$1@sea.gmane.org> (raw)
In-Reply-To: <45AC8932.6080400@math.uni-koeln.de>

Daniel Rubin wrote:
> (I'm new here, so first of all: Best greetings to everyone!)

Welcome!

> I have a problem concerning local variables in files (set by a
> "Local Variables:" block at the end of a file).
> 
> Here's what I'm trying to achieve:
> 
> In C++ files, I'd like to set the indentation style (stroustrup),
> apply some customizations (indentation inside namespace blocks),
> and turn on a specific documentation comment style (javadoc).  I
> currently do it like this:
> 
>> // Local Variables:
>> // c-file-style:"stroustrup"
>> // c-file-offsets:((innamespace . 0))
>> // c-doc-comment-style:javadoc
>> // End:
> 
> 
> Setting the indentation style and changing the indentation inside
> namespaces works fine, but the doc-comment style is NOT set.
> 
> Looking at variable c-doc-comment-style, it tells me that it's
> local within that buffer and having a setting different from the
> global default:
> 
>> c-doc-comment-style's value is ((java-mode . javadoc)
>>  (pike-mode . autodoc))
>>
>> Local in buffer EadesLinSmythProgression.hpp; global value is 
>> ((c++-mode . javadoc)
>>  (java-mode . javadoc)
>>  (pike-mode . autodoc))
> 
> 
> The documentation on c-file-style says that having a non-zero
> value for this variable automatically makes all style variables
> local, so I guess that's the problem.
> 
> How do I manage to set the doc-comment style?
> 
> Defining an own style (in my personal Emacs config) including that
> setting is not an option, as other people (with other config
> files) should be able to work with these files without nuking the
> indentation.
> 
> emacs-version: 21.4.1
> mode: c++-mode (CC Mode version 5.30.9) (Semantic version 2.0pre3)
> OS: Linux (Fedora Core 4)

I don't know if any of this applies to Emacs 21.4, but the CC Mode
manual distributed with Emacs 22.0.92 says the following:

,----
|      The default value for `c-doc-comment-style' is
|      `((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc))'.
|
|      Note that CC Mode uses this variable to set other variables that
|      handle fontification etc.  That's done at mode initialization or
|      when you switch to a style which sets this variable.  Thus, if you
|      change it in some other way, e.g. interactively in a CC Mode
|      buffer, you will need to do `M-x java-mode' (or whatever mode
|      you're currently using) to reinitialize.
|
|      Note also that when CC Mode starts up, the other variables are
|      modified before the mode hooks are run.  If you change this
|      variable in a mode hook, you'll have to call
|      `c-setup-doc-comment-style' afterwards to redo that work.
`----

These are just guesses, but you could try forcing a call to
c-setup-doc-comment-style in the Local Variables block (after you
set c-doc-comment-style):

	eval: (c-setup-doc-comment-style)

or via the mode hook (in your ~/.emacs):

	(add-hook 'c++-mode-hook 'c-setup-doc-comment-style)

-- 
Kevin Rodgers
Denver, Colorado, USA

  reply	other threads:[~2007-01-18  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16  8:13 Local Variables question: c-file-style and c-doc-comment-style Daniel Rubin
2007-01-18  6:21 ` Kevin Rodgers [this message]
2007-01-18  8:53   ` Daniel
2007-01-19  7:14     ` Kevin Rodgers
2007-01-19  8:01       ` Daniel Rubin
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16  8:21 Daniel

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='eon3kb$ifb$1@sea.gmane.org' \
    --to=kevin.d.rodgers@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).