问题描述:

I want to create a command line executable which will spawn an emacs window/application.

I searched on the internet and found that the emacs shipped with Mac is not supported in X11 window So, I downloaded the latest emacs from http://emacsformacosx.com/ and installed it in my mac.
Then I go to the /usr/bin directory and create a symbolic link like this:

sudo ln /Applications/Emacs.app/Contents/MacOS/Emacs xemacs

when I run this symblolic link by ./xemacs it says(. means /usr/bin):

Warning: arch-dependent data dir

(/Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/MacOS//libexec/emacs/24.2/x86_64-apple-darwin/)

does not exist. Warning: arch-independent data dir

(/Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/Resources/share/emacs/24.2/etc/)

does not exist. Error: charsets directory not found:

/Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/Resources/share/emacs/24.2/etc/charsets

Emacs will not function correctly without the character map files.

Please check your installation!

But if I run the Emacs binary in directory /Applications/Emacs.app/Contents/MacOS/ it starts the application without any error.

Any one knows how to solve this problem?

网友答案:

Up to this point I think the best way is to create an executable script under /usr/bin which will execute the binary file /Applications/Emacs.app/Contents/MacOS/Emacs. The reason I didn't use "open" command is that I need to use some Emacs binary arguments. Compared to "open" this method can spawn multiple instance of emacs.

The script is :

#! /bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "[email protected]"

Then make it executable by doing chmod +x script.sh

then make the symlink

ln -s "/usr/local/bin/script.sh" /usr/local/bin/xemacs

网友答案:

You could use an alias: alias emacs="open -a Emacs --args <youroptions>. The option --args allows you to pass options directly to emacs (e.g., -q avoids the evaluation of the init script).

相关阅读:
Top