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 12:08:56 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.99 (gnu/linux)

Kevin Rodgers <address@hidden> writes:

> Hadron wrote:
>> To answer (or provide a solution) my own issue, it works now.
>>
>> I simply added the my-compile extract directly as a c-mode-hook e.g
>>
>> ,----
>> | (add-hook 'c-mode-common-hook
>> |   (lambda ()
>> |     (unless (or (file-exists-p "makefile")
>> |            (file-exists-p "Makefile"))
>> |       (set (make-local-variable 'compile-command)
>> |       ;; $(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)))))
>> | )
>> `----
>>
>> Which suggests something strange with make-local-variable?
>
> No, the problem is simply with the definition of your function:
>
> (defun my-compile ()
>   (message "in my-compile")
>   (lambda () ...))
>
> The lambda form is self-evaluating and has no side-effect -- in
> particular, the ellided body forms are not evaluated when my-compile
> is called.

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 :-;).


-- 


reply via email to

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