all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Preventing indentation of statements inside #ifdef __cplusplus....
@ 2007-06-14 14:13 Nordlöw
  2007-06-17  6:30 ` Ariel Shaqed (Scolnicov)
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2007-06-14 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

How can I instruct Emacs *not* to indent declarations and definitions
such as the statement foo(); between the following standard snippets?:

#ifdef __cplusplus
extern "C" {
#endif

foo();

#ifdef __cplusplus
}
#endif


Thanks,
Nordlöw

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Preventing indentation of statements inside #ifdef __cplusplus....
  2007-06-14 14:13 Preventing indentation of statements inside #ifdef __cplusplus Nordlöw
@ 2007-06-17  6:30 ` Ariel Shaqed (Scolnicov)
  0 siblings, 0 replies; 2+ messages in thread
From: Ariel Shaqed (Scolnicov) @ 2007-06-17  6:30 UTC (permalink / raw)
  To: help-gnu-emacs

Nordlöw wrote:

> How can I instruct Emacs *not* to indent declarations and definitions
> such as the statement foo(); between the following standard snippets?:
> 
> #ifdef __cplusplus
> extern "C" {
> #endif
> 
> foo();
> 
> #ifdef __cplusplus
> }
> #endif

You can define and use the following style.

1. Add to your .emacs:
  ;;; C++ style: don't indent namespaces
  (c-add-style "my_style"
             '("user"
               (c-offsets-alist
                (inextern-lang . 0))))
2. In the buffer, try "C-c . my_style RET" to try it out, then if
satisfied "M-x customize-variable c-default-style RET" and set up c++-mode
to use my_style.

Note that the above *always* inhibits indentation of extern "C" bodies, not
just those #ifdef'ed out.  I consider this the right thing to do -- you
might not.

Hope this helps,
-- 
Ariel.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-17  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14 14:13 Preventing indentation of statements inside #ifdef __cplusplus Nordlöw
2007-06-17  6:30 ` Ariel Shaqed (Scolnicov)

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.