Emacs: Set HOME directory
- Windows
- to set
g:/Dropbox/
as HOME directory for my emacs startup on my second hard disk of my desktop PC, create a batch file *.bat with
set HOME=G:/Dropbox
C:\emacs-26.3-x86_64\bin\runemacs.exe --debug-init
- Linux
- to set the HOME directory for my emacs starup to the directory where the bash script file *.sh resides in (e. g. USB stick)
- 1. create myemacs.sh script (code below)
- 2. make script executable:
chmod +x myemacs.ls
#!/bin/bash
# Get absolute path of myemacs.sh
# hint from https://stackoverflow.com/a/1638397 2020-04-13
SCRIPTFULLFILENAME=$(readlink -f "$0")
# Absolute path
SCRIPTPATHNAME=$(dirname "$SCRIPTFULLFILENAME")
# Start emacs
# hint from https://stackoverflow.com/a/21569451 2020-04-13
# env HOME=$SCRIPTPATHNAME emacs -q -l .emacs.d/init.el
env HOME=$SCRIPTPATHNAME emacs