From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Tony Harbin Newsgroups: gmane.emacs.help Subject: Re: automatic indentation in C,C++ modes Date: Wed, 24 Apr 2002 10:53:55 -0500 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3CC6D513.B5BE078A@hiwaay.net> References: <3CB7662B.82AA21D9@hiwaay.net> <3CBB052E.4B5C6FAB@hiwaay.net> <3CC05446.50EEB4AD@hiwaay.net> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=------------866CE48957B15DC764CEBF44 X-Trace: main.gmane.org 1019666673 9157 127.0.0.1 (24 Apr 2002 16:44:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2002 16:44:33 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 170Pse-0002Na-00 for ; Wed, 24 Apr 2002 18:44:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 170PCQ-0003VG-00; Wed, 24 Apr 2002 12:00:54 -0400 Original-Received: from sed04.sed.redstone.army.mil ([136.205.12.4]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 170PB8-0003Jr-00 for ; Wed, 24 Apr 2002 11:59:34 -0400 Original-Received: from hiwaay.net (dh900-249.sed.redstone.army.mil [136.205.148.246]) by sed04.sed.redstone.army.mil (PMDF V6.0-24 #41095) with ESMTP id <01KGXTV9XUWE00008W@sed04.sed.redstone.army.mil>; Wed, 24 Apr 2002 10:59:32 -0500 (CDT) Original-To: help-gnu-emacs@gnu.org X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:165 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:165 --------------866CE48957B15DC764CEBF44 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thanks to all who helped with this. I finally found the answer. In my .emacs file, I had 2 lines: (autoload 'c++-mode "cc-mode" "C++ Editing Mode" t) (autoload 'c-mode "cc-mode" "C Editing Mode" t) However, near as I can tell, these did not actually load anything until a file matching the mode criteria was visited. Any lines referencing any variables defined by those modes were not defined in emacs' scope until a file of the mode type was visited. By then it's too late to affect any of the variables. By changing the lines to: (load "cplus-md.elc") (load "c-mode.elc") The variables (especially c-auto-newline...thanks G Anna!) are now defined and can be manipulated; in my case, to turn off the auto-indentation feature: (setq c-auto-newline nil) This gets me what I need, but is it wasteful? --------------866CE48957B15DC764CEBF44 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Thanks to all who helped with this.  I finally found the answer.

In my .emacs file, I had 2 lines:

(autoload 'c++-mode "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode   "cc-mode" "C Editing Mode" t)

However, near as I can tell, these did not actually load anything until a file matching the mode criteria was visited.  Any lines referencing any variables
defined by those modes were not defined in emacs' scope until a file of the mode type was visited.  By then it's too late to affect any of the variables.  By changing
the lines to:

(load "cplus-md.elc")
(load "c-mode.elc")

The variables (especially c-auto-newline...thanks G Anna!) are now defined
and can be manipulated; in my case, to turn off the auto-indentation feature:

(setq c-auto-newline nil)

This gets me what I need, but is it wasteful?
 
  --------------866CE48957B15DC764CEBF44--