help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with c-mode-common-hook


From: Hadron
Subject: Re: help with c-mode-common-hook
Date: Thu, 03 May 2007 16:48:18 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.99 (gnu/linux)

Kai Grossjohann <address@hidden> writes:

> Hadron <address@hidden> writes:
>
>> I'm not sure what ellided means. But how come it works in my direct
>> add-hook then? The "old" way was working before (famous last words :-;).
>
> The "direct" method works because you have different code in that
> case.
>
> To make the "direct" method fail, you need to do this:
>
> (add-hook 'c-mode-common-hook 
>           (lambda ()
>             (lambda ()
>               ...same code as before)))
>
> As you can see, there is one lambda too many.
>

But there wasnt 2 lambdas in my other way:

| (defun my-compile ()
|   (message "in my-compile")
|   (lambda ()
|     (unless (file-exists-p "Makefile")
|       (set (make-local-variable 'compile-command)
|          ;; emulate make's .c.o implicit pattern rule, but with
|          ;; different defaults for the CC, CPPFLAGS, and CFLAGS
|          ;; variables:
|          ;; $(CC) -c -o $@ $(GTKFLAGS) $(CPPFLAGS) $(CFLAGS) $<
|          (let ((file (file-name-nondirectory buffer-file-name)))
|            (format "%s -o %s %s %s %s %s"
|                    (or (getenv "CC") "gcc")
|                    (file-name-sans-extension file)
|                    (or (getenv "GTKFLAGS") "")
|                    (or (getenv "CPPFLAGS")"-DDEBUG=9")
|                    (or (getenv "CFLAGS") "-std=c99 -pedantic -Wall -Werror 
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion  
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
-Wredundant-decls -Wnested-externs -Winline -g")
|                    file)))))
|   )

Am I missing something glaringly obvious here? I am more than willing to
believe I inadvertently broke my code when tidying up or something but I
cant see it. I just pasted the entire "original code" into the add-hook
call and it worked.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]