Here's a tip I received from R. Paul Wiegand showing how one can pass
command line options to Emacs:
-----
You will need to do two things:
1.) Create a script file which you will use to launch emacs at the
command line (say: em). Obviously make sure it is in path...
2.) Add a few lines to your .emacs files.
The script I use is:
#!/bin/tcsh
# Set env vars to load in .emacs
setenv EMACS_LOAD_PATH `pwd`
setenv EMACS_LOAD_FILENAME $1
# Supply the correct path to your Emacs.app directory (by default
# it is in the <build>/mac directory
open -a /Applications/Document\ Tools/Emacs.app/
The lines I've added to my .emacs file are:
;; Pick up env vars from script
(setq rpw-emacs-load-path (getenv "EMACS_LOAD_PATH"))
(setq rpw-emacs-load-filename (getenv "EMACS_LOAD_FILENAME"))
;; Check if vars exist, or (for filename) were blank
(cond
(rpw-emacs-load-path (cd rpw-emacs-load-path)))
(cond
(rpw-emacs-load-filename
(cond
( (not (equal rpw-emacs-load-filename ""))
(find-file rpw-emacs-load-filename)))))
Now I can do the following from the command line:
% cd ~/
% em .emacs
and it will load my .emacs file (or whatever file I specify). If I
specify no command line option, emacs opens, as usual but the working
directory is the current directory where I launched it. If I
double-click on the icon, it launches as it would otherwise.
|