[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-x compile for different file extensions

From: Kevin Rodgers
Subject: Re: M-x compile for different file extensions
Date: Tue, 22 Oct 2002 11:17:21 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

Kai Gro├čjohann wrote:

There is one argument in favor of automatically selecting the right
compile command.  Suppose a user has a lot of *.giggle files and they
want to run "mumblefrotz" on them to produce *.stiffle files.
Suppose that the *.giggle files are all over the place, not just in
one directory.  Then it might be convenient for these users to select
the compile-command based on the major mode of the buffer, instead of
writing makefiles everywhere with basically the same contents.  (The
user might not have the right to edit the global make.rules file.)

Yes, and the doc string for compile-command and the Compilation node of
the manual both point the user in toward using a buffer local value for
the variable.  Perhaps the documentation just needs to be a little more
explicit for novice users, but I had no trouble figuring out:

(add-hook 'giggle-mode-hook
          (lambda ()
            (let ((giggle-file (file-name-nondirectory buffer-file-name)))
              (set (make-local-variable 'compile-command)
                   (format "mumblefrotz -o %s.stiggle %s"
                           (file-name-sans-extension giggle-file)

But it might be nice if the user could just do something like

(add-to-list 'auto-compile-command-alist
             '("\\.giggle\\'" . "mumblefrotz -o %s.stiggle %s.giggle"))


reply via email to

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