[Top][All Lists]

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

Re: M-x compile for different file extensions

From: Ehud Karni
Subject: Re: M-x compile for different file extensions
Date: Tue, 22 Oct 2002 21:03:48 +0200

On Tue, 22 Oct 2002 11:17:21 -0600, Kevin Rodgers <address@hidden> 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)
>                          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"))

This needs a fair knowledge of emacs lisp (It requires to define major
mode). It should be customizable to let lay people use it for their own
extensions. The ekcompl.el let the lay user do it interactively (by the
`compile-ext-edit' command).


 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry

reply via email to

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