#!/bin/csh -f # Open the specified files in the Emacs editor. emacsautosaves if (-e '/Applications/Aquamacs Emacs.app') then if ($#argv == 0) then open -n -a '/Applications/Aquamacs Emacs.app' # -n = New instance of the editor, even if another instance is already # open. # -a = Application to open else if (! -e $1:q) then # Create the file if it doesn't exist, since open doesn't do so. # TODO: Should loop and create all specified files, not just first one touch $1:q open -W -n -a '/Applications/Aquamacs Emacs.app' $*:q # -W = Wait till editor exits before proceeding. # Delete the file if still zero length after editing. # This is especially useful for typos in filenames, so the misspelled # file doesn't get created and left there. # TODO: Should loop and delete all specified empty files, not just # first one if (-z $1:q) rm -i -v $1:q else open -n -a '/Applications/Aquamacs Emacs.app' $*:q # :q = Quote each incoming arg in case it contains embedded spaces # and such. endif else emacs $*:q endif