Another choice is to use a new env var set the way you want. Set A to /some/path and then open file $A/thesis.
(Works in emacs 20.7.1 for Windows).
And, FWIW, no reason not to have an A, B, C, D, ... or however many different path shortcuts you might need.


From: Glynn Clements [mailto:glynn@gclements.plus.com]
Sent: Sat 4/26/2008 9:34 PM
To: Tim Connors
Cc: xemacs-beta@xemacs.org
Subject: Re: resetting xemacs' idea of home directory


Tim Connors wrote:

> I want to reset a running xemacs' idea of where my $HOME directory is (I
> want to temporarily work in a different filesystem with my main xemacs
> process) so that when I open a file in ~/thesis/..., it goes to
> <directory>/thesis/....
>
> (setenv "HOME" ...) didn't do what I was hoping it would do (obviously it
> would for subshells).  Is there a way?

Not easily. XEmacs caches the result of getenv("HOME"), and there
isn't any way to un-cache it from lisp. Also, the variable which
stores the home directory isn't a lisp variable, so you can't just set
or bind it.

You could modify e.g. find-file-noselect (e.g. with defadvice) to
detect a filename beginning with "~/" and substitute your alternate
home directory.

You could even intercept expand-file-name if you want the change to
affect everything. However, that will get a bit messy, as
expand-file-name is a built-in function, so you can't use defadvice,
and if you want to override the definition, you'll need to store
(symbol-function 'expand-file-name) somewhere so that you can call it
from your wrapper.

--
Glynn Clements <glynn@gclements.plus.com>




"Misys" is the trade name for Misys plc (registered in England and Wales). Registration Number: 01360027. Registered office: Burleigh House, Chapel Oak, Salford Priors, Evesham WR11 8SP. For a list of Misys group operating companies please go to http://www.misys.com/html/about_us/group_operating_companies/. This email and any attachments have been scanned for known viruses using multiple scanners.
 
We believe that this email and any attachments are virus free, however the recipient must take full responsibility for virus checking. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys plc. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing.