all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs: Suppressing auto indentation for C source files
@ 2005-10-14 14:53 Generic Usenet Account
  2005-10-14 18:28 ` J. David Boyd
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Generic Usenet Account @ 2005-10-14 14:53 UTC (permalink / raw)


My apologies if this posting is off topic.

I want to suppress the auto indentation for C source files in my emacs
editor (GNU Emacs 21.2.1, XEmacs 21.4).  I have added the following two
lines in my .emacs file, but that does not seem to help:

(setq indent-tabs-mode nil)
(setq c-indent-line nil)

Any suggestions?

Thanks,
Gus

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

* Re: Emacs: Suppressing auto indentation for C source files
  2005-10-14 14:53 Emacs: Suppressing auto indentation for C source files Generic Usenet Account
@ 2005-10-14 18:28 ` J. David Boyd
  2005-10-17 13:53 ` Alan Mackenzie
  2005-11-11 10:26 ` Faried Nawaz
  2 siblings, 0 replies; 4+ messages in thread
From: J. David Boyd @ 2005-10-14 18:28 UTC (permalink / raw)


"Generic Usenet Account" <usenet@sta.samsung.com> writes:

> My apologies if this posting is off topic.
>
> I want to suppress the auto indentation for C source files in my emacs
> editor (GNU Emacs 21.2.1, XEmacs 21.4).  I have added the following two
> lines in my .emacs file, but that does not seem to help:
>
> (setq indent-tabs-mode nil)
> (setq c-indent-line nil)
>
> Any suggestions?
>
> Thanks,
> Gus


I have this in my .emacs to set up things for c-mode:


(defun my-c-mode-common-hook ()
  (c-set-style "user")
  (c-set-offset 'case-label '+)
  (c-set-offset 'substatement-open 0)
  (setq fill-column 75)
  (imenu-add-menubar-index)
  (add-hook 'c-mode-hook 'turn-on-cwarn-mode)
  (add-hook 'c-mode-hook
	    (lambda ()
	      (set (make-local-variable 'ispell-skip-region-alist)
		   (cons '("\\\\[abfnrtv\\'\"]") ispell-skip-region-alist))))
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


You need something like this, modified to hold the values you want to set...

Dave

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

* Re: Emacs: Suppressing auto indentation for C source files
  2005-10-14 14:53 Emacs: Suppressing auto indentation for C source files Generic Usenet Account
  2005-10-14 18:28 ` J. David Boyd
@ 2005-10-17 13:53 ` Alan Mackenzie
  2005-11-11 10:26 ` Faried Nawaz
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2005-10-17 13:53 UTC (permalink / raw)


[Newsgroups: trimmed - Followupto: set]

In gnu.emacs.help Generic Usenet Account <usenet@sta.samsung.com> wrote:
> My apologies if this posting is off topic.

None needed.  The posting is bang on topic.

> I want to suppress the auto indentation for C source files in my emacs
> editor (GNU Emacs 21.2.1, XEmacs 21.4).

The term "auto indentation" covers several aspects in CC Mode.
(i) There's the indentation which happens when you type <TAB> or C-j.
(ii) There's the "electric indentation" which happens when you type a
semicolon or parenthesis or ....

In the current versions of CC Mode (5.28 or 5.30.n:  use M-x c-version to
see which one you've got), there isn't much control you can exercise over
these.  In the soon-to-be-released CC Mode 5.31, you can independently
disable the "electric indentation".

> I have added the following two lines in my .emacs file, but that does
> not seem to help:

> (setq indent-tabs-mode nil)
> (setq c-indent-line nil)

`c-indent-line' doesn't exist.  `indent-tabs-mode' merely says whether
you want to use (mainly) tabs to indent with or only spaces.

> Any suggestions?

Try (setq c-syntactic-indentation nil).  If you still want to be able to
indent with <TAB> or C-j, wait for CC Mode 5.31, which will be available
on <http://www.sourceforge.net/release.php> some time "soon".

> Thanks,
> Gus

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

* Re: Emacs: Suppressing auto indentation for C source files
  2005-10-14 14:53 Emacs: Suppressing auto indentation for C source files Generic Usenet Account
  2005-10-14 18:28 ` J. David Boyd
  2005-10-17 13:53 ` Alan Mackenzie
@ 2005-11-11 10:26 ` Faried Nawaz
  2 siblings, 0 replies; 4+ messages in thread
From: Faried Nawaz @ 2005-11-11 10:26 UTC (permalink / raw)


Auto indentation?  What do you mean?  You type

if (foo) {

and when you hit newline, the cursor's indented?

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

end of thread, other threads:[~2005-11-11 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-14 14:53 Emacs: Suppressing auto indentation for C source files Generic Usenet Account
2005-10-14 18:28 ` J. David Boyd
2005-10-17 13:53 ` Alan Mackenzie
2005-11-11 10:26 ` Faried Nawaz

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.