从 emacs 调用 vim 或 TextMate

发布于 2024-09-17 20:51:23 字数 729 浏览 9 评论 0原文

我已经使用 vi 有一段时间了,使用 Mac 时,我有时会使用 TextMate,最后,我发现了 emacs 的伟大之处。而且,我很可能会选择 emacs。

问题是,我有时需要其他(vi/TextMate)编辑器来做一些事情。并不是说 emacs 没有该功能,而是我现在需要该功能,并且我知道如何使用“其他”编辑器来做到这一点。另一位编辑也是如此。

我的问题是如何从另一个编辑器启动一个编辑器。这不仅仅是启动一个应用程序,而是使用我正在编辑的文件启动一个应用程序。

  • 如何从 emacs 启动 vi 或 TextMate(mate)?
  • 如何从 vi 启动 emacs 或 mate?
  • 如何从 TextMate 启动 vi 或 emacs?

添加

在 Jérôme Radix 回答之后,我想出了以下命令。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给不了的爱 2024-09-24 20:51:23

如何从 emacs 启动 vi 或 TextMate(mate)?

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

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

要启动 TextMate,您需要安装 TextMate 的命令行工具,然后从 emacs 启动,这是(thx Chetan):

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

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

但最好的办法是就是同时打开所有3个编辑器并在它们之间切换。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文