Last active
June 18, 2016 02:18
-
-
Save halcyon/92e9c25c5b2e6e787c8887871b9f12ed to your computer and use it in GitHub Desktop.
Start railwaycat's OSX emacs port from the shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias e='/usr/local/bin/emacs' | |
| is_arg_p() { | |
| [[ ${1} == $'-'* ]] | |
| } | |
| file_not_found_p() { | |
| [[ ! -f ${1} ]] | |
| } | |
| emacs() { | |
| emacs_args=() | |
| files=() | |
| for token; do | |
| if is_arg_p ${token} | |
| then | |
| emacs_args+=${token} | |
| else | |
| files+=${token} | |
| if file_not_found_p ${token} | |
| then | |
| touch "${token}" | |
| fi | |
| fi | |
| done | |
| if [[ ${#emacs_args[@]} -eq 0 ]] | |
| then | |
| open -a emacs ${files} | |
| else | |
| open -a emacs ${files} --args ${emacs_args} | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment