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: Kevin Rodgers
Subject: Re: help with c-mode-common-hook
Date: Thu, 03 May 2007 00:26:15 -0600
User-agent: Thunderbird 1.5.0.10 (Macintosh/20070221)

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.

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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