From: Alan M. <ac...@mu...> - 2006-07-31 14:09:53
|
Hi, Reuben! On Mon, Jul 31, 2006 at 02:01:53PM +0100, Reuben Thomas wrote: > After reading all the documentation I can find, I'm still unable to > answer this simple question: for programming in C99, how can I change > the line comment style so that M-; gives me a // comment rather than a > /* ... */ one? Hmm. The honest answer is that CC Mode doesn't have a way of toggling between "/*" and "//". That's embarrassing! You're the first person to raise the point, and what you want to do is certainly reasonable. There really ought to be some sort of option that you can toggle. Maybe I can work out a good way to do this for CC Mode 5.32 (which, hopefully, will be getting released 1 - 2 years from now). In the meantime, here's a workaround. Put this into your .emacs[*]. It will have the effect of setting the standard Emacs variables `comment-start' and `comment-end' to insert a "//" comment: (defun rt-do-line-comments () (setq comment-start "// ") (setq comment-end "")) (add-hook 'c-mode-hook 'rt-do-line-comments) Please try this, and let me know if it doesn't do exactly what you need. Alternatively, if you're experienced with creating CC Mode styles, you could incorporate these two variable settings into your style. [*] "your .emacs" might mean your site-start.el, or even your init.el (if you're using XEmacs). Just a small point. When reporting bugs, it can often be helpful to tell us what version of Emacs/XEmacs you're using, and what version of CC Mode. You can get this info with M-x emacs-version, M-x xemacs-version and M-x c-version. Even better, C-c C-b from a CC Mode buffer gives a complete dump of your configuration, and this can be invaluable in tracking down things like indentation bugs. And now for a bit of advertising: CC Mode's current version is 5.31.3, and if you're not using it yet, you could download it from <http://cc-mode.sourceforge.net/release.php>. Amongst other features, the manual has been extensively revised. Thanks for reporting this lack of a feature! -- Alan Mackenzie (Munich, Germany) |