chemacs
chemacs copied to clipboard
Wrong .emacs path on Windows 10
The current powershell script tries to deal with this, but even though I hadn't set %HOME%, it still copied .emacs
to C:/Users/<username>/
instead of c:/Users/<username>/AppData/Roaming/
To get it to work, I ran in powershell
[Environment]::SetEnvironmentVariable("HOME", "C:\Users\$env:UserName", "User")
Then used this https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html#download to create a symlink to the .emacs file in C:/Users/$env:UserName/
. (You could also use #18.)
I'm not really up to date on the Powershell situation since I rarely use Windows. Any chance you could add some instructions to the README for people that come looking for what to do?
Sure, see below. I think the current script could even be modified to do the first option automatically.
In PowerShell:
- cd to where you want to keep chemacs (e.g.
cd C:\Users\$env:UserName
) - clone chemacs:
git clone https://github.com/plexus/chemacs.git
- create the
%HOME%
variable emacs uses:
[Environment]::SetEnvironmentVariable("HOME", "C:\Users\$env:UserName", "User")
- create a hardlink from chemacs's
.emacs
to your home directory:
New-Item -Path C:\Users\$env:UserName\.emacs -ItemType HardLink -Target chemacs\.emacs
Note this uses a hardlink so you don't need admin rights. Hardlinks only work on the same drive/filesystem. If you have admin rights and want to create it on a different drive, then follow the following steps instead.
I'll use D:\MySpecialHome
as the example for where you want your emacs home directory to be.
In PowerShell:
- open another PowerShell, this one as admin:
Start-Process powershell -Verb runAs
- a UAC dialog will pop up, confirm it to open the admin PowerShell
- now in the admin PowerShell, cd to where you want to keep chemacs:
cd D:\MySpecialHome
- clone chemacs:
git clone https://github.com/plexus/chemacs.git
- create the
%HOME%
variable emacs uses:
[Environment]::SetEnvironmentVariable("HOME", "D:\MySpecialHome", "User")
- create a symlink from chemacs's
.emacs
to your home directory:
New-Item -Path D:\MySpecialHome\.emacs -ItemType SymbolicLink -Target chemacs\.emacs
Great! Could you add this to the README please? (i.e. pull request?)