unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs and C programming
@ 2007-12-07 17:20 Co$t@ntino
  2007-12-07 17:49 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Co$t@ntino @ 2007-12-07 17:20 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
I add this line in my .emacs file:

(define-key c-mode-base-map "\C-m' newline-and-indent)

To make RET (newline, C-m) equivalent to LFD (newline and indent, C-j).

But when start Emacs says: "Symbol's value as variable is void: 
c-mode-base-map".
How could I fix it?

Thanks, Costantino


P.S.Running Emacs22 on Debian Sid.



-- 
Linux non è un sistema operativo, ma un modo diverso per affrontare la 
propria esistenza.
http://linuxrevenge.wordpress.com/
Powered by:
  _____       _     _                _____ _     _
|  __ \     | |   (_)              / ____(_)   | |
| |  | | ___| |__  _  __ _ _ __   | (___  _  __| |
| |  | |/ _ \ '_ \| |/ _` | '_ \   \___ \| |/ _` |
| |__| |  __/ |_) | | (_| | | | |  ____) | | (_| |
|_____/ \___|_.__/|_|\__,_|_| |_| |_____/|_|\__,_|

linux 2.6.23.1-handmaded

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

* Re: Emacs and C programming
  2007-12-07 17:20 Emacs and C programming Co$t@ntino
@ 2007-12-07 17:49 ` David Kastrup
  2007-12-07 17:50 ` Sven Joachim
  2007-12-07 18:29 ` Peter Dyballa
  2 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2007-12-07 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

"Co$t@ntino" <costailmigliore@hotmail.com> writes:

> Hi,
> I add this line in my .emacs file:
>
> (define-key c-mode-base-map "\C-m' newline-and-indent)
>
> To make RET (newline, C-m) equivalent to LFD (newline and indent, C-j).
>
> But when start Emacs says: "Symbol's value as variable is void:
> c-mode-base-map".
> How could I fix it?

(eval-after-load 'cc-mode
  '(define-key c-mode-base-map "\C-n" 'newline-and-indent))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Emacs and C programming
  2007-12-07 17:20 Emacs and C programming Co$t@ntino
  2007-12-07 17:49 ` David Kastrup
@ 2007-12-07 17:50 ` Sven Joachim
  2007-12-07 18:04   ` Co$t@ntino
  2007-12-07 18:29 ` Peter Dyballa
  2 siblings, 1 reply; 5+ messages in thread
From: Sven Joachim @ 2007-12-07 17:50 UTC (permalink / raw)
  To: help-gnu-emacs

On 2007-12-07 18:20 +0100, Co$t@ntino wrote:

> Hi,
> I add this line in my .emacs file:
>
> (define-key c-mode-base-map "\C-m' newline-and-indent)
>
> To make RET (newline, C-m) equivalent to LFD (newline and indent, C-j).
>
> But when start Emacs says: "Symbol's value as variable is void:
> c-mode-base-map".

Surely, because c-mode has not been loaded yet.

> How could I fix it?

Use a hook to set the keybinding, e.g.

(add-hook 'c-mode-common-hook
	  (lambda ()
	    (define-key c-mode-base-map "\C-m" 'newline-and-indent)))

does the trick for me.  See also the Emacs manual,
(Info "(emacs)Hooks").

Cheers,
       Sven

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

* Re: Emacs and C programming
  2007-12-07 17:50 ` Sven Joachim
@ 2007-12-07 18:04   ` Co$t@ntino
  0 siblings, 0 replies; 5+ messages in thread
From: Co$t@ntino @ 2007-12-07 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

SNIP

Thanks a lot everybody! Now it works properly :-D




-- 
Linux non è un sistema operativo, ma un modo diverso per affrontare la 
propria esistenza.
http://linuxrevenge.wordpress.com/
Powered by:
  _____       _     _                _____ _     _
|  __ \     | |   (_)              / ____(_)   | |
| |  | | ___| |__  _  __ _ _ __   | (___  _  __| |
| |  | |/ _ \ '_ \| |/ _` | '_ \   \___ \| |/ _` |
| |__| |  __/ |_) | | (_| | | | |  ____) | | (_| |
|_____/ \___|_.__/|_|\__,_|_| |_| |_____/|_|\__,_|

linux 2.6.23.1-handmaded

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

* Re: Emacs and C programming
  2007-12-07 17:20 Emacs and C programming Co$t@ntino
  2007-12-07 17:49 ` David Kastrup
  2007-12-07 17:50 ` Sven Joachim
@ 2007-12-07 18:29 ` Peter Dyballa
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2007-12-07 18:29 UTC (permalink / raw)
  To: Co$t@ntino; +Cc: help-gnu-emacs


Am 07.12.2007 um 18:20 schrieb Co$t@ntino:

> But when start Emacs says: "Symbol's value as variable is void: c- 
> mode-base-map".
> How could I fix it?

(require 'cc-mode) ?

--
Greetings

   Pete

Sometimes I think the surest sign that intelligent life exists  
elsewhere in the universe is that none of it has tried to contact us.
			– Bill Watterson, in his comic strip Calvin and Hobbes

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

end of thread, other threads:[~2007-12-07 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-07 17:20 Emacs and C programming Co$t@ntino
2007-12-07 17:49 ` David Kastrup
2007-12-07 17:50 ` Sven Joachim
2007-12-07 18:04   ` Co$t@ntino
2007-12-07 18:29 ` Peter Dyballa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).