help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: C-c C-c for a file extension


From: liyer . vijay
Subject: Re: C-c C-c for a file extension
Date: 4 May 2006 16:54:30 -0700
User-agent: G2/0.2

The answer would be slightly different if your gnuplot files have a
major mode (do they?), but for now, you can just do

M-: (local-set-key "\C-c\C-c" 'compile)

And then C-c C-c will run the compile command.  The first time you call
compile, it will start with "make -k" but you can change that to
gnuplot <filename>

If you're really lazy, you could do something like this:

(defun compile-gnuplot (filename)
  "Runs gnuplot on FILENAME taking (buffer-file-name) as default."
  (interactive (let ((name (buffer-file-name)))
                 (list (read-string (format "Filename (default %s) "
name)
                                  nil
                                  name))))
  (compile (format "gnuplot %s" filename)))

Then, in your buffer,
M-: (local-set-key "\C-c\C-c" 'compile-gnuplot)

I'm new to emacs lisp so comments on code also requested.  Ideally, the
function should also ask to save the buffer if it is modified.  But I
don't know elisp that well.

Hope this helps.

Cheers
Vijay Lakshminarayanan

> Can we quote you on that?
A long time ago, someone in the Lisp industry told me it was poor form
quote people; it suggests that they lack value.
        -- Kent M Pitman <pitman@world.std.com> in comp.lang.lisp



reply via email to

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