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

Hadron <hadronquark@gmail.com> writes:

> Robert Thorpe <rthorpe@realworldtech.com> writes:
>
>> On May 2, 7:00 pm, Hadron <hadronqu...@gmail.com> wrote:
>>> I put "message" calls in so I know the functions are calling each other
>>> but for some reason the compile command is staying at the default "make
>>> -k" even if there is no makefile in the c files directory. What have I
>>> broken? It used to work. Or something similar used to work....
>>
>> You're going to have to describe the problem more.  The code you've
>> shown doesn't change the command "M-x compile" as far as I can see.
>
> It doesnt. It changes the compile-command variable. AFAIK - I am not a
> lisp programmer.
>
>>
>> Are the messages you put in seen?
>>
>
> Yes - I mentioned that I think.

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?


reply via email to

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