all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: liyer.vijay@gmail.com
Subject: Re: C-c C-c for a file extension
Date: 4 May 2006 16:54:30 -0700	[thread overview]
Message-ID: <1146786870.845468.303390@g10g2000cwb.googlegroups.com> (raw)
In-Reply-To: <e3dpsm$ne6$1@news.service.uci.edu>

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

      parent reply	other threads:[~2006-05-04 23:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 20:59 C-c C-c for a file extension Rares Vernica
2006-05-04 23:43 ` Kevin Rodgers
2006-05-05  7:50   ` Reiner Steib
2006-05-12  3:12     ` Rares Vernica
2006-05-04 23:54 ` liyer.vijay [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1146786870.845468.303390@g10g2000cwb.googlegroups.com \
    --to=liyer.vijay@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.