LoginSignup
4

More than 5 years have passed since last update.

EmacsからEclipse、EclipseからEmacsへと駆け抜けるコマンドとプラグインを導入する

Posted at

現在Eclipseをメインに開発をやっておりますが、生粋のEmacs使いの僕にとって
Eclipseって編集作業するのには本当に苦行です。

なので、Eclipseでファイルを開いているときにEmacsで同じファイルを開き、
Emacsでファイルを開いているときにEclipseで同じファイルを開きたいと思いました。

EclipseからEmacsへ

emacs-eclipse

Eclipseでファイルを開いていて、Emacsで同じファイルを開くようにする
プラグインを導入します。

手順通りにインストール、EmacsとかEclipseとか再起動すると、
右上にアイコンが出てるので、クリックするとEclipseのエディタで
開いているファイルをそのままEmacsで見ることが出来ます。

emacsclientが立ち上がっているのが必須ですけども。

Eclipse→Emacsのラインは通ったけど、
Emacs→Eclipseのラインをどうにかして通したい。

インストール手順

1 git clone

git clone https://github.com/anirudhsasikumar/emacs-eclipse.git

2 emacs-eclipse-plugin_1.3.0.jar を eclipseの plugins ディレクトリに移す。

3

init.el
(load "~/elisp/eclipse-goto-offset.el")

を書く。ディレクトリは適宜修正すること。

4 server-startとかしてemacsclientが使えるようにする。

以上。

emacs-eclipseで快適なEmacsライフの一助を

EmacsからEclipseへ

Cygwin限定。

Cygwinメインで使っているときは、以下のように書くといい。

init.el
;; open
(defun open ()
  "Let's open file!!"
  (interactive)
  (cond ((eq system-type 'darwin)
         (shell-command (concat "open " (buffer-file-name))))
        ((eq system-type 'windows-nt)
         (shell-command (concat "cygstart " (buffer-file-name))))
        )
  )
(global-set-key "\C-co" 'open)

openは予め指定されたアプリケーションでファイルを開くコマンド。

Linuxのopenに相当するコマンドがCygwinにもあって、cygstartという。

Emacsでそれを実行する。Macならopen Windowsならcygstartを
実行するように書き換えてみる。

こんな風にEmacs Lispを書きまして、Finderとかエクスプローラーとかで
ファイルを開くアプリケーションを指定すれば、cygstartやopenを実行すると
そのアプリケーションでファイルを開く。

Emacsから別アプリケーションでファイルを開く

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4