From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hadron Newsgroups: gmane.emacs.help Subject: help with c-mode-common-hook Date: Wed, 02 May 2007 20:00:41 +0200 Message-ID: <87vefb3y2e.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 1178142654 4170 80.91.229.12 (2 May 2007 21:50:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 May 2007 21:50: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 Wed May 02 23:50:52 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 1HjMio-0005K8-4K for geh-help-gnu-emacs@m.gmane.org; Wed, 02 May 2007 23:50:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HjMpF-0004LY-RA for geh-help-gnu-emacs@m.gmane.org; Wed, 02 May 2007 17:57:29 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-X-Trace: individual.net tncOXIgQLScNAiePgROfdQ7GN6VPCSaBy5dkUT17MUPrCmALLH 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:TR56gvvDAXchc6JDBBvFvv/Z8KY= Original-Xref: shelby.stanford.edu gnu.emacs.help:147923 X-Mailman-Approved-At: Wed, 02 May 2007 17:51:16 -0400 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:43545 Archived-At: This is one of those "used to work last time I tried but now it's broken". Maybe I messed something up in the my-compile? I have a function which sets the compile command per C file. If a makefile exists, use it, else use gcc. ,---- | (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))))) | ) `---- which is called from my c-init ,---- | (defun my-c-init() | | ;; *SNIP* | | ;; (defvar gud-gdb-command-name "gdb -q") | (setq gud-gdb-command-name "gdb -q") | | (my-compile) | | ) `---- my-c-init is in turn added as c file hook: ,---- | (add-hook 'c-mode-common-hook 'my-c-init) `---- 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....