Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
On OS X, how do I start Cocoa emacs and bring it to front?

I have Emacs for OS X installed on my MacBook Pro. In order to launch Emacs from the command line, I have created a file called /usr/bin/emacs with the following contents:

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

and I have chmoded the file to make it executable.

However, when I launch emacs from the command line, the emacs GUI window goes to the bottom of the UI stack and the terminal window stays on top. Is there any way I can get the emacs GUI to go to the top of the UI stack?

share|improve this question
add comment

marked as duplicate by slhck, 8088, Tom Wijsman, ChrisF, Dennis Jul 11 '12 at 18:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

You could add something like this:

osascript -e 'tell application "Emacs" to activate'

This will launch an AppleScript event that brings up the Emacs window, wherever it is.

share|improve this answer
    
Adding that line and commenting out the /Applications/Emacs.app/Contents/MacOS/Emacs "$@" line worked but then the emacs window that launches does not open the file that I passed in as the argument to the emacs command on the command line. –  Das Sep 19 '11 at 20:57
    
Also...if I add that line without commenting out the /Applications/Emacs.app/Contents/MacOS/Emacs "$@" line, then it just launches 2 sets of windows with the one containing the file I was trying to open still at the bottom of the UI stack. –  Das Sep 19 '11 at 21:01
    
Found the correct solution here - superuser.com/questions/73500/… –  Das Sep 19 '11 at 21:07
    
Ah, fair enough. Let's just close it then. –  slhck Sep 19 '11 at 21:18
add comment

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