Calling vim or TextMate from emacs

天涯浪子 提交于 2019-12-01 20:44:06

问题


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))))

回答1:


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.



来源:https://stackoverflow.com/questions/3668914/calling-vim-or-textmate-from-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!