4

Is it possible to script Eclipse so I can quickly open a source file that is open in Eclipse with emacs (or emacsclient)?

1

2 Answers 2

4

Go to Window Preferences then choose General/Editor/File Associations. Add "emacsclientw" to .*java file association. You will be able to use "Open With Emacsclient" from the Navigator or the Package Explorer.

Not so quick but better than nothing.

3

I don't like the file associations solution by Oleg because then eclipse will try to open the file in Emacs the next time you open it in the package explorer.

I setup a script that runs emacsclient as an external tool.

I use a script in ~/bin/openInEmacs.sh like this:

#!/bin/bash
emacsclient --quiet --no-wait "$@"
wmctrl -a emacs

I do this because sometimes emacs doesn't come to the front with emacsclient from eclipse.

Go to external tools configuration. click the add icon. Name the new tool emacsclient. set: location to ~/bin/openInEmacs.sh, Working directory to ${container_loc} arguments to ${selected_resource_loc}

Under the common tab click display in favorites menu, check 'launch in background'. Uncheck the console and file outputs.

The to use this, select a file in the package explorer and click emacsclient under toolbar button for external tools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.