Hi,
I'd like to know how to specify at the command line which directory Emacs
should use as the .emacs.d directory. I see the --user flag, but it seems
unnecessarily inflexible.
One use case I would like this for is so as I can run Emacs unintrusively
on a colleague's computer. --user flag doesn't serve the purpose for
technical reasons and I currently symlink their ~/.emacs.d to my .emacs.d
on a network share. For my colleagues who also use Emacs, this creates an
awkwardness whereby I backup their .emacs.d before creating my symlink, and
then remember to restore it later when finished.
Another use case is that I'm getting my Emacs configuration to work on
Windows, and I discovered that Windows shortcuts are apparently .lnk files
and don't function like a symlink. I'm unsure how to use a .emacs.d at an
arbitrary location, and only know to copy it to home instead. This is
inconvenient because I want to use a .emacs.d straight out of a Mercurial
repo located elsewhere.
Specifying a .emacs.d location as a command line flag would be a big help.
> Specifying a .emacs.d location as a command line flag would be a big help.
Do you need that path for GNU Emacs that it finds some Elisp files? The environment variable EMACSLOADPATH can point to additional directories. This variable matches the use of the GNU Emacs variable load-path. This one can be changed in some init file, for example when the user is someone particular…
--
Greetings
Pete
Think of XML as Lisp for COBOL programmers.
- Tony-A (some guy on /.)
Barry OReilly <gundaeti...@gmail.com> writes:
> Specifying a .emacs.d location as a command line flag would be a big
> help.
You could use apropos-value to list all variables which refer to
.emacs.d and then modify those from command line using --eval (although
sometimes that directory is hardcoded, e.g. in startup.el as a fallback
value). In particular, user-emacs-directory is of interest, and I'd
trying changing it, then run apropos-value to see what remains.
"Nicolas Richard" <theonewiththeevill...@yahoo.fr> writes:
> Barry OReilly <gundaeti...@gmail.com> writes:
>> Specifying a .emacs.d location as a command line flag would be a big
>> help.
> You could use apropos-value to list all variables which refer to
> .emacs.d and then modify those from command line using --eval (although
> sometimes that directory is hardcoded, e.g. in startup.el as a fallback
> value). In particular, user-emacs-directory is of interest, and I'd
> trying changing it, then run apropos-value to see what remains.
> Another use case is that I'm getting my Emacs configuration to work on
> Windows, and I discovered that Windows shortcuts are apparently .lnk
> files and don't function like a symlink. I'm unsure how to use a
> .emacs.d at an arbitrary location, and only know to copy it to home
> instead. This is inconvenient because I want to use a .emacs.d straight
> out of a Mercurial repo located elsewhere.
I can't help with the Emacs part of your question, but Vista and higher
have true (though still a bit brain dead in some respects) symlinks.
Look at the 'mklink' command.
You'll need a privilege that isn't granted to users by default (silly
decision #1), and while you can change that, for a one-off thing it's
easier to just elevate yourself when opening the command prompt. Also
note that Windows symlinks are specific to either pointing to a file or
a directory, so you'll have to explicitly tell 'mklink' that you want a
directory symlink.
On XP and 2000 (and also Vista and higher) you also have both hard links
and something called "directory junctions" available. (Windows is
capable of creating hard links to directories. Presumably you have to be
careful not to shoot yourself in the foot by creating a cycle.) I think
'mklink' may create hard links too though I'm not sure; for directory
junctions, there are a couple third-party utilities, e.g. Mark
Russinovich's 'junction':
http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
>> Barry OReilly <address@hidden> writes:
>>> Specifying a .emacs.d location as a command line flag would be a big
>>> help.
>> You could use apropos-value to list all variables which refer to
>> .emacs.d and then modify those from command line using --eval (although
>> sometimes that directory is hardcoded, e.g. in startup.el as a fallback
>> value). In particular, user-emacs-directory is of interest, and I'd
>> trying changing it, then run apropos-value to see what remains.
>`user-emacs-directory' is a defconst.
I removed ~/.emacs.d, verified no ~/.emacs, executed:
emacs --eval '(setq user-emacs-directory "my/path/.emacs.d/")'
It did not work. More precisely, Emacs did not load
my/path/.emacs.d/init.el . C-h v does show that user-emacs-directory has
the /my/path/.emacs.d value, however.
Barry OReilly <gundaeti...@gmail.com> writes:
> It did not work. More precisely, Emacs did not load my/path/.emacs.d
> /init.el . C-h v does show that user-emacs-directory has the /my/
> path/.emacs.d value, however.
Ok, I had not quite understood what you wanted to do. My suggestion
would then be to run emacs as:
emacs -q --eval '(setq user-emacs-directory "~/.my.other.emacs.d")' --eval '(load (concat user-emacs-directory "/init.el"))'
It is far from optimal but maybe it can work for you.