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

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

launching external program with (buffer filename as parameter)


From: ex
Subject: launching external program with (buffer filename as parameter)
Date: Sun, 3 May 2009 18:21:08 -0700 (PDT)
User-agent: G2/1.0

Hi fellows :D

I'm used to run my scripts with only one keyboard touch (F5), (F6),
(F7), etc...
I was using Editplus that allowed me to define user-tools
the idea is very simple:

1) save current document
2) launch system command: [name_program] [document_path]
3) [name_program] runs in his own window, output/errors are printed in
that window...

with this simple schema I could run my perl, python, ruby, etc scripts
just changing the program name, i.e:
  ruby my/ruby/script/path
It's very simple and convenient, I'm even able to send by email the
current document using perl (forgive please!)
perl_mailing_script [document_path]

Of course I now have a python-mode with lots of things to play, and it
could be easy just use that, but I think in order to really learn
emacs I need to know how to emulate the above steps.
The other problem is that with ruby the mode-compile uses lots of code
to do just 3 simple steps (and is annoying me with the arguments
question), this is my .emacs:

;;------------------------------------------------------------------------------
;; Install mode-compile
(require 'mode-compile)

(autoload 'mode-compile "mode-compile"
    "Command to compile current buffer file based on the major mode"
t)
(global-set-key [(f5)] 'mode-compile)

(autoload 'mode-compile-kill "mode-compile"
    "Command to kill a compilation launched by `mode-compile'" t)
(global-set-key [(pause)] 'mode-compile-kill)

(setq mode-compile-always-save-buffer-p t) ;; Always save
;;------------------------------------------------------------------------------

AS you can see, I was able to always save the buffer, but can not
disable the arguments question.

So please help me!
How can I make this to work?

;;------------------------------------------------------------------------------
(defun my-simple-ruby-shell
  (save-active-buffer)
  (shell "ruby -w %f" (active-buffer-file-path))
;;------------------------------------------------------------------------------

I guess I'm just missing some glue there, sorry about my elisp
ignorance,
I'm just tired of trying this thing to work.

Best regards
Laurens



reply via email to

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