tags:

views:

73

answers:

1

I've been using vi quite a while, and with a Mac, I sometimes use TextMate, and finally, I found the greatness of emacs. And, it's very likely that I settle in emacs.

The problem is, I sometimes need the other (vi/TextMate) editor for doing something. It's not that emacs doesn't have the feature, it's just that I need the feature right now, and I know how to do that with the 'other' editor. And the same is true with the other editor.

My question is how can I launch the one editor from the other. It's not just launching an app, but launching an app with the file that I'm editing.

  • How can I launch vi or TextMate(mate) from emacs?
  • How can I launch emacs or mate from vi?
  • How can I launch vi or emacs from TextMate?

ADDED

After Jérôme Radix's answer, I came up with the following command.

(defun runmate ()
  (interactive)
  (runeditor "/Users/smcho/bin/mate"))

(defun runeditor (editor)
  (let (filename (file-truename buffer-file-name))
    (setq cmd (format "%s %s" editor (file-truename buffer-file-name)))
    (save-window-excursion
      (async-shell-command cmd))))
+3  A: 

How can I launch vi or TextMate(mate) from emacs?

(async-shell-command "vi")  ;; From Emacs 23.2

(shell-command "vi &")  ;; Before Emacs 23.2

to launch TextMate, you need to install TextMate's command line tools, and then from emacs, it's (thx Chetan):

(async-shell-command "mate") ;; From Emacs 23.2 

(shell-command "mate &") ;; Before Emacs 23.2

But the best thing to do is to open all 3 editors at the same time and switch between them.

Jérôme Radix
And to launch TextMate, you need to install TextMate's command line tools, and then from emacs, it's: `(async-shell-command "mate") ;; From Emacs 23.2` or`(shell-command "mate ; Before Emacs 23.2`
Chetan