From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Newsgroups: gmane.emacs.help Subject: Re: Local Variables question: c-file-style and c-doc-comment-style Date: Thu, 18 Jan 2007 09:53:01 +0100 Message-ID: <45AF356D.1030706@warum-ada.de> References: <45AC8932.6080400@math.uni-koeln.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1169110407 10613 80.91.229.12 (18 Jan 2007 08:53:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 18 Jan 2007 08:53:27 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 18 09:53:24 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H7T1O-0000GT-Dk for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jan 2007 09:53:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7T1O-0003hg-Rw for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jan 2007 03:53:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H7T18-0003gj-FK for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 03:53:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H7T16-0003f7-Je for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 03:53:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7T16-0003ev-FT for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 03:53:04 -0500 Original-Received: from [194.8.194.66] (helo=smtp3.netcologne.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H7T15-0001G6-UW for help-gnu-emacs@gnu.org; Thu, 18 Jan 2007 03:53:04 -0500 Original-Received: from [192.168.0.4] (xdsl-87-78-35-144.netcologne.de [87.78.35.144]) by smtp3.netcologne.de (Postfix) with ESMTP id 42B136756B; Thu, 18 Jan 2007 09:53:02 +0100 (CET) User-Agent: Thunderbird 1.5.0.4 (X11/20060516) Original-To: Kevin Rodgers In-Reply-To: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40412 Archived-At: Thank you, Kevin! (Please see below for my comments on your suggestions.) Kevin Rodgers wrote: > 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) > Yes, you're right, this part is in the documentation of my version of Emacs, too. Unfortunately, the `eval:' line has no effect. Indeed, the variable `c-doc-comment-style' doesn't even have the value I set it to by the file variables after opening the c++-file anymore. So I think the call to `c-setup-doc-comment-style' comes too late. (Same situation no matter whether I use `eval:' or `c++-mode-hook'.) Hmm... I just noticed that the problem went away completely in CC Mode version 5.31.3. :-) Another thing I found out is that on at least one machine that other users will most probably work on when doing changes to my source files has only ancient CC Mode version 5.28 installed, which doesn't even know about `c-doc-comment-style'. :-( So I think I'll just stick with the solution that works in the recent CC Mode version (and is clean) and live with whatever might happen to my sources. Thanks again, Kevin. You didn't solve my problem but helped me to look at it in another way, discovering it wasn't that critical at all. I'm quite happy with what I've got now. Have fun ----Daniel