From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hadron Newsgroups: gmane.emacs.help Subject: Re: help with c-mode-common-hook Date: Thu, 03 May 2007 12:08:56 +0200 Message-ID: <87r6pyw75z.fsf@gmail.com> References: <87vefb3y2e.fsf@gmail.com> <1178130129.512841.259390@y5g2000hsa.googlegroups.com> <87647b3wdu.fsf@gmail.com> <87y7k6rbyp.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1178188494 26037 80.91.229.12 (3 May 2007 10:34:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 May 2007 10:34:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 03 12:34:51 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HjYe8-0004XT-N8 for geh-help-gnu-emacs@m.gmane.org; Thu, 03 May 2007 12:34:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HjYke-0006Be-3C for geh-help-gnu-emacs@m.gmane.org; Thu, 03 May 2007 06:41:32 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!panix!newsfeed-00.mathworks.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-X-Trace: individual.net Q8LrLLz4jtak0qQ/QIkpOQ4BCFySLPGentSjXpnB+SchFap28X X-Orig-Path: news.individual.net!news X-Face: 2h#||Cd#d%F*NCm59[_6/{1a@jy%; |j>{D~4^gKg(^i%7j0IK?+,/GmW&:CD5fEKb_! User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.99 (gnu/linux) Cancel-Lock: sha1:9beF5ZClXef0XlNOJc2YY9WmaVQ= Original-Xref: shelby.stanford.edu gnu.emacs.help:147987 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:43585 Archived-At: Kevin Rodgers 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 :-;). --