Try adding the following to your c-mode-common-hook (or whatever hook you
are using for C++ mode):
(c-set-offset 'innamespace 0)
-Tony
When I am in console-mode, this may not be what I want, especially
when more than one namespace is active.
Is there a way to turn this off ?
The current emacs-20.5-documentation is a bit short on languages other
than C. How about collecting some hints on C++-indentation (or maybe
perl etc) ? - I'm not saying I volunteer, but I will help.
thanks,
--
Felix Natter
> The current emacs-20.5-documentation is a bit short on languages other
> than C. How about collecting some hints on C++-indentation (or maybe
> perl etc) ? - I'm not saying I volunteer, but I will help.
Well, C, C++ and Objective C are all handled by CC mode. The generic
way to customize indentation in these modes is to type C-c C-o on the
first line which has wrong indentation, then to follow the prompts.
You can later recall the c-set-offset statements you need with C-x ESC
ESC and M-p/M-n.
Indentation in Perl is different, but I don't know how. And then
there's CPerl mode which has yet another way to customize
indentation. But I'd guess that M-x apropos-variable RET
perl.*\(indent\|offset\) RET would give you a start.
kai
--
~/.signature: No such file or directory
Nina
On 01 Apr 2000 21:44:55 +0200, Kai.Gro...@CS.Uni-Dortmund.DE
I basically needs the configuration statements for my java-mode. I am
using Emacs 20.4.1 on Redhat Linux 6.1. Basically, I have a bunch of
(c-set-offset (....)) statements I don't know what to do with...
Thanks.
>Also if there is a compiled version of .emacs (.emacs.elc), Emacs
>loads that instead. You can remove it or recompile .emacs.
My .emacs file located in my home directory:
(require 'cc-mode)
(custom-set-variables '(c-basic-offset 2))
(c-set-offset (quote topmost-intro) 0 nil)
(c-set-offset (quote defun-block-intro) 2 nil)
(c-set-offset (quote substatement-open) 0 nil)
(c-set-offset (quote statement-block-intro) 2 nil)
(c-set-offset (quote case-label) 2 nil)
(c-set-offset (quote statement-case-intro) 2 nil)
The settings do not take effect when I start up Emacs, and I need to
do a M-x eval-buffer. Is there a way to make the settings take effect
automatically as soon as Emacs is started and I start to edit a JAVA
file? I need that for my Java mode. Thanks.
Nina
;; c-mode-common-hook is called for all cc-modes
(add-hook 'c-mode-common-hook
'(lambda ()
(setq c-basic-offset 2)
(c-set-offset 'topmost-intro 0)
(c-set-offset 'defun-block-intro 2)
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-block-intro 2)
(c-set-offset 'case-label 2)
(c-set-offset 'statement-case-intro 2)))
If you want all the items that end in 2 to be indented one more level then
you probably want '+ not 2.
-Tony
To clarify, I should have said all lines that end in 2 EXCEPT for the
c-basic-offset line, should be '+ not 2.
-Tony
Nina
On Sun, 2 Apr 2000 16:31:17 -0700, "Tony Sideris" <tony...@erols.com>
wrote:
> I am new to this Emacs stuff, so could you please tell me how I can
> put the recalled LISP statements into my .emacs file? I copied all
> into my .emacs file, but they do not seem to have any effect.
(defun my-c-indent-setup ()
...c-set-offset.statements.go.here...)
(add-hook 'c-mode-hook 'my-c-indent-setup)